-
Notifications
You must be signed in to change notification settings - Fork 11
61 lines (52 loc) · 1.97 KB
/
bump-version.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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 }}