Skip to content

Commit f582f7a

Browse files
committed
Add CI job for npm publish
1 parent 0d4abf1 commit f582f7a

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

.github/workflows/npm.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: NPM Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- "*.*.*"
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-22.04
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Set version variable
18+
id: vars
19+
run: |
20+
APP_VERSION=${GITHUB_REF#refs/tags/}
21+
echo "version: [$APP_VERSION]"
22+
echo "{version}={$APP_VERSION}" >> $GITHUB_OUTPUT
23+
24+
- name: Set version in package.json
25+
uses: actions/setup-node@v3
26+
with:
27+
node-version: "16.x"
28+
registry-url: "https://registry.npmjs.org"
29+
- run: yarn version --new-version $APP_VERSION --no-git-tag-version
30+
env:
31+
APP_VERSION: ${{ steps.vars.outputs.version }}
32+
33+
- name: Publish
34+
run: npm publish
35+
env:
36+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
37+
38+
# vim:ft=yaml:et:ts=2:sw=2

0 commit comments

Comments
 (0)