Skip to content

Commit 338d990

Browse files
committed
ci: Added JS Deployment
Deployment for JS will take place after goreleaser has finished its work and created a new release. With the latest tag, the version of npm package will be upgraded. Then the npm package will be published
1 parent 49c3d15 commit 338d990

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.github/workflows/publish_npm.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Publish NPM Package
2+
on:
3+
workflow_dispatch:
4+
workflow_run:
5+
workflows: [goreleaser]
6+
types:
7+
- completed
8+
9+
jobs:
10+
publish_npm:
11+
name: Publish NPM
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout sources
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-tags: true
18+
- name: Install node.js
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: 18
22+
- name: Install dependencies
23+
working-directory: ./bdist/js
24+
run: npm install --ignore-scripts
25+
- name: Set package version
26+
working-directory: ./bdist/js
27+
run: npm run version
28+
- name: Pack NPM Package
29+
working-directory: ./bdist/js
30+
run: npm pack
31+
- name: Issue warning if NPM_TOKEN is not set
32+
env:
33+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
34+
run: |
35+
echo "::warning title=Missing authentication token::In order to publish an NPM package, you must set the NPM_TOKEN secret"
36+
if: ${{ env.NODE_AUTH_TOKEN == '' }}
37+
- name: Publish NPM package
38+
env:
39+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
40+
run: npm publish
41+
if: ${{ env.NODE_AUTH_TOKEN != '' }}
42+

0 commit comments

Comments
 (0)