-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (89 loc) · 3.53 KB
/
hotfix-release.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Start Hotfix Release
on:
workflow_dispatch:
inputs:
version:
description: 'Version to hotfix'
required: true
type: number
env:
RELEASE_BRANCH: 'release/v${{ inputs.version }}.x'
permissions:
contents: write
concurrency:
# Only run one instance of this workflow at a time
group: ${{ github.workflow }}
jobs:
check-inputs:
name: Check Inputs
runs-on: ubuntu-latest
steps:
- name: Check release branch exists
# Check inputs with a GitHub API request rather than checking out repo
# first and using git show-ref --verify, because this is much faster.
run: |
curl --location \
--head \
--silent \
-w "%{http_code}" \
-H "Authorization: token ${{ github.token }}" \
"https://api.github.com/repos/${{ github.repository }}/branches/${{ env.RELEASE_BRANCH }}" \
| grep -q "^200$" || exit 1
rc-pr:
name: Create Release Candidate PR
runs-on: ubuntu-latest
needs: check-inputs
steps:
- name: Create GitHub App Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.RELEASE_BOT_APP_ID }}
private-key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ env.RELEASE_BRANCH }}
token: ${{ steps.app-token.outputs.token }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Parse version
id: version
uses: ./.github/parse-version
- name: Get RC Branch
id: branches
run: |
echo "rc=rc/v${{ steps.version.outputs.releaseShort }}" >> $GITHUB_OUTPUT
- name: Create branches
run: |
git config --global user.name 'awana-release-bot[bot]'
git config --global user.email '${{ vars.RELEASE_BOT_USER_ID }}+awana-release-bot[bot]@users.noreply.github.com'
git checkout -b ${{ steps.branches.outputs.rc }}
- name: Set target release version in package.json
run: |
npm version ${{ steps.version.outputs.releaseVersion }} --no-git-tag-version
git commit -am "chore: prepare for release v${{ steps.version.outputs.releaseShort }}"
- name: Push changes
run: |
git push origin ${{ steps.branches.outputs.rc }}
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Create Pull Request
run: |
gh pr create \
--base ${{ env.RELEASE_BRANCH }} \
--head ${{ steps.branches.outputs.rc }} \
--title "$PR_TITLE" \
--body "$PR_BODY"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
PR_TITLE: Hotfix Release Candidate v${{ steps.version.outputs.releaseShort }}
PR_BODY: |
This PR tracks QA of the release candidate for hotfix v${{ steps.version.outputs.releaseShort }}.
:cherries: All changes to this branch should be cherry-picked from `${{ github.event.repository.default_branch }}`.
:warning: Only add bug fixes, copy edits and translation updates during the QA process.
:test_tube: Create a new Release Candidate build by commenting on this PR with the `/buildrc` command.
:construction: An initial Release Candidate build will be triggered shortly, and the build URL will be posted here.
:rocket: Merging this PR will trigger a release build.