-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (68 loc) · 2.29 KB
/
canary-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
name: Canary Release
on:
issue_comment:
types:
- created
permissions:
contents: read
pull-request: write
package: write
jobs:
canary release:
name: canary release
runs-on: ubuntu-latest
if: |
github.event_name == 'issue_comment' &&
(github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'CONTRIBUTOR') &&
startsWith(github.event.comment.body, 'canary-release')
steps:
- name: get PR information
uses: actions/github-script@v4
id: pr
with:
script: |
const request = {
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
}
core.info(`Getting PR #${request.pull_number} from ${request.owner}/${request.repo}`)
try {
const result = await github.pulls.get(request);
core.info(`Got PR: ${JSON.stringify(result.data)}`);
return result.data;
} catch (err) {
core.setFailed(`Request failed with error: ${err}`)
}
- name: checkout
uses: actions/checkout@v2
with:
ref: ${{ fromJSON(steps.pr.outputs.result).head.ref }}
repository: ${{ fromJSON(steps.pr.output.result).head.repo.full_name }}
fetch-depth: 0
- name: setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 20.x
registry-url: 'https://npm.pkg.github.com'
- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 8.11
- name: Install
run: pnpm install
- name: Publish
run: pnpm run release:canary
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '🎉 Canary Release. You can install canary version via `npm install [package]@next`'
})