Skip to content

Commit 5667302

Browse files
committed
Use publish action
1 parent 29aa95b commit 5667302

File tree

1 file changed

+11
-28
lines changed

1 file changed

+11
-28
lines changed

.github/workflows/publish.yml

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,13 @@ jobs:
1616
uses: ./.github/actions/setup
1717
with:
1818
node_version: '12'
19-
registry_url: https://registry.npmjs.org
20-
- name: Check version
21-
id: version
22-
run: |
23-
echo "::set-output name=name::$(jq -r '.name' package.json)"
24-
echo "::set-output name=current::$(jq -r '.version' package.json)"
25-
echo "::set-output name=published::$(npm view $(jq -r '.name' package.json)@$(jq -r '.version' package.json) version)"
26-
env:
27-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2819
- name: Build
2920
run: npn run build
30-
- name: Publish ${{ steps.version.outputs.name }}@${{ steps.version.outputs.current }}
31-
if: ${{ endsWith(github.ref, format('v{0}', steps.version.outputs.published)) == false }}
32-
run: npm publish --access public
33-
env:
34-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
21+
- name: Publish
22+
uses: JS-DevTools/npm-publish@v1
23+
with:
24+
access: public
25+
token: ${{ secrets.NPM_TOKEN }}
3526
github:
3627
runs-on: ubuntu-20.04
3728
steps:
@@ -41,19 +32,11 @@ jobs:
4132
uses: ./.github/actions/setup
4233
with:
4334
node_version: '12'
44-
registry_url: https://npm.pkg.github.com
45-
- name: Check version
46-
id: version
47-
run: |
48-
echo "::set-output name=name::$(jq -r '.name' package.json)"
49-
echo "::set-output name=current::$(jq -r '.version' package.json)"
50-
echo "::set-output name=published::$(npm view $(jq -r '.name' package.json)@$(jq -r '.version' package.json) version)"
51-
env:
52-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5335
- name: Build
5436
run: npm run build
55-
- name: Publish ${{ steps.version.outputs.name }}@${{ steps.version.outputs.current }}
56-
if: ${{ endsWith(github.ref, format('v{0}', steps.version.outputs.published)) == false }}
57-
run: npm publish --access public
58-
env:
59-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
- name: Publish
38+
uses: JS-DevTools/npm-publish@v1
39+
with:
40+
access: public
41+
token: ${{ secrets.GITHUB_TOKEN }}
42+
registry: https://npm.pkg.github.com

0 commit comments

Comments
 (0)