-
-
Notifications
You must be signed in to change notification settings - Fork 533
63 lines (53 loc) · 1.8 KB
/
beta-release.yaml
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
name: Beta Release
on:
workflow_call:
jobs:
beta_release:
runs-on: ubuntu-latest
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- uses: actions/setup-node@v4
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
- name: Install dev dependencies
run: yarn install
- name: Setup npm credentials file
run: echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" >> .npmrc
- name: Setup git credentials
run: |
git config --global user.name 'Auto Release Bot'
git config --global user.email '[email protected]'
- name: Get current package.json version
run: echo "PACKAGE_VERSION=$(npm pkg get version)" >> $GITHUB_ENV
- name: Setup Beta Release Version
run: node beta-release.js --issue $GITHUB_PR_NUMBER
env:
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
- name: Release a new beta version
run: npm publish --tag beta
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Beta version released with the last commit 🚀
\`\`\`
yarn add react-tooltip@${{ env.NEW_VERSION }}
\`\`\`
or
\`\`\`
npm install react-tooltip@${{ env.NEW_VERSION }}
\`\`\`
`
})