-
Notifications
You must be signed in to change notification settings - Fork 88
42 lines (34 loc) · 1.01 KB
/
publish-npm.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
name: Publish to NPM
on:
workflow_run:
workflows: [ "Release" ]
types:
- completed
jobs:
publish-npm:
if: github.event.workflow_run.conclusion == 'success'
name: Publish to NPM
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set version
id: vars
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: Use Node.js 16
uses: actions/setup-node@v1
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- name: Setup Git user
run: |
git config --global user.name "Github Bot"
git config --global user.email "[email protected]"
- name: Create .npmrc file
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: NPM publish
run: npm publish --access public
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}