Update versions and changelogs #254
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update versions and changelogs | |
on: create | |
jobs: | |
default: | |
name: Update versions and changelogs | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write # for updating PR | |
contents: write # for opening PR | |
env: | |
IS_RC_BRANCH: ${{ startsWith(github.ref_name, 'rc/v') }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
with: | |
fetch-depth: '0' | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
- name: Get version number | |
if: env.IS_RC_BRANCH == 'true' | |
id: version-number | |
run: | | |
branch_name=${{ github.ref_name }} | |
version_number=${branch_name#rc/v} | |
echo "version_number=${version_number}" >> $GITHUB_OUTPUT | |
- name: Update versions and changelogs | |
if: env.IS_RC_BRANCH == 'true' | |
id: changelog | |
run: | | |
npm run bump-version ${{ steps.version-number.outputs.version_number }} | |
git add CHANGELOG.md | |
changelog=$(git diff HEAD CHANGELOG.md | tail -n +7 | cut -c 2-) | |
echo -e "changelog<<EOF"$'\n'"$changelog"$'\n'EOF >> $GITHUB_OUTPUT | |
- name: Set GPG | |
if: env.IS_RC_BRANCH == 'true' | |
uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.GPG_PASSPHRASE }} | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
- name: Open PR to rc branch | |
if: env.IS_RC_BRANCH == 'true' | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
title: Update versions and changelogs for ${{ steps.version-number.outputs.version_number }} | |
commit-message: 'chore: update versions and changelogs' | |
body: ${{ steps.changelog.outputs.changelog }} | |
committer: Chen Yu <[email protected]> | |
branch: chore-update-version-for-${{ github.ref_name }} |