Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit cc1a5a3

Browse files
committed
npm publish from release
1 parent 720bd63 commit cc1a5a3

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

‎.github/workflows/npm-publish.yml‎

Lines changed: 29 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,31 @@ 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+
2548
- name: publish to npm
26-
run: npm publish --tag ${{steps.get_version.outputs.VERSION}}
49+
run: npm publish . --tag ${{steps.get_package_json.outputs.prop}}@${{steps.get_package_version.outputs.prop}}
2750
env:
28-
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
51+
NPM_TOKEN: ${{secrets.NPM_TOKEN}}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /