File tree Expand file tree Collapse file tree 1 file changed +35
-6
lines changed Expand file tree Collapse file tree 1 file changed +35
-6
lines changed Original file line number Diff line number Diff line change 1
1
on :
2
- push :
3
- tags :
4
- - ' *'
2
+ release :
3
+ types : [published]
5
4
6
5
jobs :
7
6
publish :
13
12
- name : setup node
14
13
uses : actions/setup-node@v1
15
14
with :
16
- node-version : 12
15
+ node-version : 16
17
16
18
17
- name : get version from tag
19
18
id : get_version
22
21
realversion="${realversion//v/}"
23
22
echo "::set-output name=VERSION::$realversion"
24
23
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
+
25
54
- 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
27
56
env :
28
- NPM_TOKEN : ${{secrets.NPM_TOKEN}}
57
+ NPM_TOKEN : ${{secrets.NPM_TOKEN}}
You can’t perform that action at this time.
0 commit comments