-
Notifications
You must be signed in to change notification settings - Fork 2
53 lines (42 loc) · 1.34 KB
/
npm-publish.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
name: NPM publish CD workflow
on:
release:
types: [published]
jobs:
NPM-Publish:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
with:
ref: ${{ github.event.release.target_commitish }}
- uses: actions/cache@v3
name: Set up cache
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Set up node
uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: https://registry.npmjs.org/
- name: Install dependencies
run: npm ci
- name: Set publisher name
run: git config --global user.name "GitHub publish bot"
- name: Set publisher email
run: git config --global user.email "github-publish-bot@email.com"
- name: Bump the application version (package.json)
run: npm version ${{ github.event.release.tag_name }}
- name: Build application
run: npm run build
- name: Publish to NPM
run: npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Push version update (package.json)
run: git push
env:
github-token: ${{ secrets.GITHUB_TOKEN }}