Skip to content

Commit e1b9300

Browse files
authored
Merge pull request #77 from RedisGraph/ck-npmpub
npm publish from release
2 parents 720bd63 + ce3812e commit e1b9300

File tree

1 file changed

+35
-6
lines changed

1 file changed

+35
-6
lines changed

.github/workflows/npm-publish.yml

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
on:
2-
push:
3-
tags:
4-
- '*'
2+
release:
3+
types: [published]
54

65
jobs:
76
publish:
@@ -13,7 +12,7 @@ jobs:
1312
- name: setup node
1413
uses: actions/setup-node@v1
1514
with:
16-
node-version: 12
15+
node-version: 16
1716

1817
- name: get version from tag
1918
id: get_version
@@ -22,7 +21,37 @@ jobs:
2221
realversion="${realversion//v/}"
2322
echo "::set-output name=VERSION::$realversion"
2423
24+
- name: Set version from tag
25+
uses: jossef/action-set-json-field@v1
26+
with:
27+
file: package.json
28+
field: version
29+
value: ${{steps.get_version.outputs.VERSION}}
30+
31+
- name: Read project name
32+
uses: notiz-dev/github-action-json-property@release
33+
id: get_package_json
34+
with:
35+
path: package.json
36+
prop_path: name
37+
38+
- name: Read project version
39+
uses: notiz-dev/github-action-json-property@release
40+
id: get_package_version
41+
with:
42+
path: package.json
43+
prop_path: version
44+
45+
- name: npm install
46+
run: npm install
47+
48+
- name: npm login
49+
run: |
50+
npm config set //registry.npmjs.org/:_authToken ${{secrets.NPM_TOKEN}}
51+
npm publish --ignore-scripts
52+
53+
2554
- name: publish to npm
26-
run: npm publish --tag ${{steps.get_version.outputs.VERSION}}
55+
run: npm publish . --tag ${{steps.get_package_json.outputs.prop}}@${{steps.get_package_version.outputs.prop}} --ignore-scripts
2756
env:
28-
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
57+
NPM_TOKEN: ${{secrets.NPM_TOKEN}}

0 commit comments

Comments
 (0)