Skip to content

Commit 54a6549

Browse files
committed
add github release npm package and github release
1 parent 5e42820 commit 54a6549

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Publish to npm and Create GitHub Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v2
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v2
18+
with:
19+
node-version: '14'
20+
21+
- name: Install dependencies
22+
run: npm install
23+
24+
- name: Run build (if you have a build step)
25+
run: npm run build
26+
27+
- name: Publish to npm
28+
run: npm publish
29+
env:
30+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
31+
32+
- name: Get version from package.json
33+
id: get_version
34+
run: echo "::set-output name=VERSION::$(node -p -e "require('./package.json').version")"
35+
36+
- name: Create GitHub Release
37+
id: create_release
38+
uses: actions/create-release@v1
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
with:
42+
tag_name: v${{ steps.get_version.outputs.VERSION }}
43+
release_name: Release ${{ steps.get_version.outputs.VERSION }}
44+
body: |
45+
## Changes
46+
- Describe your changes here
47+
draft: false
48+
prerelease: false

0 commit comments

Comments
 (0)