Skip to content

Commit 6e83198

Browse files
committed
Add a new workflow to release beta on npm when tag contains '-beta'
1 parent 6ffe3a5 commit 6e83198

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

.github/workflows/publish-npm.yml

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,32 @@
11
name: Publish npm
22
on:
33
push:
4+
branches:
5+
- master
46
tags:
5-
- v0.**
7+
- 'v0.**'
68

79
jobs:
810
publish:
911
runs-on: ubuntu-latest
1012
steps:
11-
- uses: actions/checkout@v1
12-
- uses: actions/setup-node@v1
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-node@v3
1315
with:
14-
node-version: 16
16+
node-version: '16.x'
17+
registry-url: 'https://registry.npmjs.org'
1518
- run: yarn
16-
- run: npm test
17-
- run: npm run build
18-
- uses: JS-DevTools/npm-publish@v1
19-
with:
20-
token: ${{ secrets.NPM_TOKEN }}
19+
- run: yarn test
20+
- run: yarn build
21+
22+
- name: Beta
23+
if: ${{ contains(github.ref, '-beta') }}
24+
run: yarn publish --tag beta
25+
env:
26+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
27+
28+
- name: Current version
29+
if: ${{ !contains(github.ref, '-beta') }}
30+
run: yarn publish
31+
env:
32+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)