-
Notifications
You must be signed in to change notification settings - Fork 25
57 lines (46 loc) · 1.46 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
54
55
56
57
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: setup node
uses: actions/setup-node@v1
with:
node-version: 16
- name: get version from tag
id: get_version
run: |
realversion="${GITHUB_REF/refs\/tags\//}"
realversion="${realversion//v/}"
echo "::set-output name=VERSION::$realversion"
- name: Set version from tag
uses: jossef/action-set-json-field@v1
with:
file: package.json
field: version
value: ${{steps.get_version.outputs.VERSION}}
- name: Read project name
uses: notiz-dev/github-action-json-property@release
id: get_package_json
with:
path: package.json
prop_path: name
- name: Read project version
uses: notiz-dev/github-action-json-property@release
id: get_package_version
with:
path: package.json
prop_path: version
- name: npm install
run: npm install
- name: npm login
run: |
npm config set //registry.npmjs.org/:_authToken ${{secrets.NPM_TOKEN}}
npm publish --ignore-scripts
- name: publish to npm
run: npm publish . --tag ${{steps.get_package_json.outputs.prop}}@${{steps.get_package_version.outputs.prop}} --ignore-scripts
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}