Skip to content

Commit 8d7521a

Browse files
authored
Merge pull request #8 from kromiii/github-action
Add workflow for publishing package to npmjs
2 parents b0cda97 + 9aa6b9c commit 8d7521a

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.github/workflows/publish.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Publish Package to npmjs
2+
on:
3+
push:
4+
tags:
5+
- "v*"
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
with:
13+
fetch-depth: 0
14+
- uses: actions/setup-node@v3
15+
with:
16+
node-version: "20.x"
17+
registry-url: "https://registry.npmjs.org"
18+
- name: Config Git
19+
run: |
20+
git config user.name github-actions
21+
git config user.email github-actions@github.com
22+
- name: Update version in package.json
23+
run: |
24+
VERSION=${GITHUB_REF#refs/tags/v}
25+
npm version $VERSION --no-git-tag-version
26+
- name: Commit package.json changes
27+
run: |
28+
git add package.json
29+
git commit -m "Bump version to ${GITHUB_REF#refs/tags/v}"
30+
git push
31+
- run: npm ci
32+
- run: npm run build
33+
- run: npm publish
34+
env:
35+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)