Skip to content

Commit ad5f56e

Browse files
committed
add release & publish ci
1 parent 434e52c commit ad5f56e

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Release and publish
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
release_and_publish:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v3
14+
15+
- name: Set up Node.js
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: "20"
19+
registry-url: "https://registry.npmjs.org/"
20+
21+
- name: Install project dependencies
22+
run: npm clean-install
23+
24+
- name: Build the dist folder
25+
run: npm run build
26+
27+
- name: Create GitHub Release
28+
id: create_release
29+
uses: actions/create-release@v1
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
with:
33+
tag_name: ${{ github.ref }}
34+
release_name: ${{ github.ref }}
35+
draft: false
36+
prerelease: false
37+
38+
- name: Publish to npm
39+
run: npm publish
40+
env:
41+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,12 @@ which will create a `.tgz` file that can then be installed by the external appli
3737
```
3838
npm install /path/to/package-x.y.z.tgz
3939
```
40+
41+
### Publishing a new version
42+
43+
To make a new version and publish to npm via GitHub Actions:
44+
45+
```bash
46+
npm version <patch/minor/major>
47+
git push --follow-tags
48+
```

0 commit comments

Comments
 (0)