-
Notifications
You must be signed in to change notification settings - Fork 7
47 lines (35 loc) · 1.24 KB
/
release-package.yml
File metadata and controls
47 lines (35 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Node.js Package
on:
release:
types: [created]
jobs:
build-and-publish:
name: Build and Publish to NPM Registry
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
registry-url: 'https://registry.npmjs.org/'
- name: Install dependencies
run: npm ci
- name: Execute test cases
run: npm test
- name: Build Lib
run: npm run build-lib
- name: Publish to NPM Registry
run: |
VERSION=$(node -p "require('./package.json').version")
if [[ $VERSION == *"-beta."* ]]; then
npm publish --access public --tag beta
elif [[ $VERSION == *"-"* ]]; then
npm publish --access public --tag next
else
npm publish --access public
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}