2022-12-29 01:52:43 -05:00
name : Changesets
on :
2023-01-07 08:14:17 -05:00
workflow_dispatch :
inputs :
releaseGroup :
description : 'The release group to bump version and create pull request'
required : true
type : choice
# This should be synced with `/.scripts/version.js`
options :
- core
- toolkit
2022-12-29 01:52:43 -05:00
pull_request :
concurrency :
group : ${{ github.workflow }}-${{ github.ref }}
jobs :
changesets :
2022-12-30 00:49:00 -05:00
strategy :
matrix :
2023-01-07 08:14:17 -05:00
# Multiline expression https://stackoverflow.com/a/67532120/12514940
group : |-
${{
github.event_name == 'pull_request' &&
fromJSON('["core", "toolkit"]') ||
fromJSON(format('["{0}"]', inputs.releaseGroup))
}}
2022-12-30 00:49:00 -05:00
2022-12-29 01:52:43 -05:00
runs-on : ubuntu-latest
steps :
- uses : actions/checkout@v3
with :
token : ${{ secrets.BOT_PAT }}
- name : Setup Node and pnpm
uses : silverhand-io/actions-node-pnpm-run-steps@v2
- name : Import GPG key
uses : crazy-max/ghaction-import-gpg@v5
with :
gpg_private_key : ${{ secrets.BOT_GPG_KEY }}
passphrase : ${{ secrets.BOT_GPG_PASSPHRASE }}
git_user_signingkey : true
git_commit_gpgsign : true
git_tag_gpgsign : true
- name : Configure Git user
run : |
git config --global user.email bot@silverhand.io
git config --global user.name silverhand-bot
- name : Version packages
run : |
2022-12-30 00:49:00 -05:00
node .scripts/version.js ${{ matrix.group }}
2022-12-29 01:52:43 -05:00
pnpm i --no-frozen-lockfile
git status
- name : Create pull request
2023-01-07 08:14:17 -05:00
if : github.event_name == 'workflow_dispatch'
2022-12-29 01:52:43 -05:00
uses : peter-evans/create-pull-request@v4
with :
token : ${{ secrets.BOT_PAT }}
2022-12-30 00:49:00 -05:00
commit-message: 'release : version ${{ matrix.group }} packages'
2022-12-29 01:52:43 -05:00
committer : silverhand-bot <bot@silverhand.io>
author : silverhand-bot <bot@silverhand.io>
base : master
2022-12-30 00:49:00 -05:00
branch : release/version-${{ matrix.group }}-packages
title: 'release : version ${{ matrix.group }} packages'
body : 'This is an automatic pull request from the result of `node .scripts/version.js ${{ matrix.group }}` command. Merge it will trigger the publish flow for versioned packages.'