Skip to content

Update versions and changelogs #137

Update versions and changelogs

Update versions and changelogs #137

Workflow file for this run

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@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
with:
fetch-depth: '0'
- name: Setup Node.js
uses: actions/setup-node@v3
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@v5
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 }}