1
1
name : Staging Release
2
2
3
- on : workflow_dispatch
3
+ on :
4
+ workflow_dispatch :
5
+ inputs :
6
+ release-branch :
7
+ description : ' Release branch'
8
+ type : string
9
+ default : ' release'
10
+ required : true
11
+ source-branch :
12
+ description : ' Branch to release from'
13
+ type : choice
14
+ default : ' master'
15
+ required : true
16
+ options :
17
+ - master
18
+ - v8
4
19
5
20
jobs :
6
- warn :
7
- name : Warn If Wrong Branch
8
- runs-on : ubuntu-latest
9
- # Log a warning if run in a non-release branch.
10
- if : github.ref != 'refs/heads/release' && !endsWith(github.ref, '-releasebranch')
11
- steps :
12
- - name : Log warning
13
- run : echo "This workflow must be run in a release branch. It is being run in ${{ github.ref }}."
14
21
deploy :
15
22
name : Staging Release
16
23
runs-on : ubuntu-latest
17
- # Block this workflow if run in a non-release branch.
18
- if : github.ref == 'refs/heads/release' || endsWith(github.ref, '-releasebranch')
19
- # Allow GITHUB_TOKEN to have write permissions
20
- permissions :
21
- contents : write
22
-
24
+ # Block this workflow if run on a non-release branch.
25
+ if : github.event.inputs.release-branch == 'release' || endsWith(github.event.inputs.release-branch, '-releasebranch')
23
26
steps :
24
27
- name : Set up Node (14)
25
28
uses : actions/setup-node@v2
@@ -28,20 +31,21 @@ jobs:
28
31
- name : Merge master into release
29
32
uses : actions/github-script@v6
30
33
with :
31
- github-token : ${{ secrets.GITHUB_TOKEN }}
34
+ github-token : ${{ secrets.OSS_BOT_GITHUB_TOKEN }}
32
35
script : |
33
- let branch = context.ref.replace("refs/heads/", "")
34
- await github.rest.repos.merge({
36
+ const result = await github.rest.repos.merge({
35
37
owner: context.repo.owner,
36
38
repo: context.repo.repo,
37
- base: branch,
38
- head: 'master '
39
+ base: '${{ github.event.inputs.release- branch }}' ,
40
+ head: '${{ github.event.inputs.source-branch }} '
39
41
})
42
+ console.log(result)
40
43
- name : Checkout current branch (with history)
41
44
uses : actions/checkout@master
42
45
with :
43
46
# Release script requires git history and tags.
44
47
fetch-depth : 0
48
+ ref : ${{ github.event.inputs.release-branch }}
45
49
- name : Yarn install
46
50
run : yarn
47
51
- name : Publish to NPM
0 commit comments