-
Notifications
You must be signed in to change notification settings - Fork 2
42 lines (39 loc) · 1.28 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
name: Publish to NPM
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# "ref" specifies the branch to check out.
# "github.event.release.target_commitish" is a global variable and specifies the branch the release targeted
ref: ${{ github.event.release.target_commitish }}
- uses: actions/setup-node@v3
with:
node-version: 20
- run: npm ci
publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.release.target_commitish }}
- uses: actions/setup-node@v3
with:
node-version: 20
registry-url: https://registry.npmjs.org/
scope: '@kinescope'
- run: npm ci
- run: git config --global user.name "GitHub CD bot"
- run: git config --global user.email "[email protected]"
# upgrade npm version in package.json to the tag used in the release.
- run: npm version ${{ github.event.release.tag_name }} --allow-same-version
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
# push the version changes to GitHub
- run: git push