name: Changesets on: 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 pull_request: concurrency: group: ${{ github.workflow }}-${{ github.ref }} jobs: changesets: strategy: matrix: # Multiline expression https://stackoverflow.com/a/67532120/12514940 group: |- ${{ github.event_name == 'pull_request' && fromJSON('["core", "toolkit"]') || fromJSON(format('["{0}"]', inputs.releaseGroup)) }} 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: | node .scripts/version.js ${{ matrix.group }} pnpm i --no-frozen-lockfile git status - name: Create pull request if: github.event_name == 'workflow_dispatch' uses: peter-evans/create-pull-request@v4 with: token: ${{ secrets.BOT_PAT }} commit-message: 'release: version ${{ matrix.group }} packages' committer: silverhand-bot author: silverhand-bot base: master 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.'