-
Notifications
You must be signed in to change notification settings - Fork 8
46 lines (35 loc) · 1.01 KB
/
publish.yaml
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
name: Publish to npm
on:
push:
tags:
- 'v*'
jobs:
publish:
runs-on: 'ubuntu-22.04'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Version check
run: |
package_json_version=$(node -e 'console.log(require("./package.json").version)')
if [ "v$package_json_version" != $GITHUB_REF_NAME ]; then
echo "Version in package.json (v$package_json_version) does not match the tag ($GITHUB_REF_NAME)"
exit 1
fi
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: https://registry.npmjs.org/
- name: Install dependencies
run: npm ci
- name: Prettier
run: npm run prettier:check
- name: TypeScript
run: npm run type-check
- name: Build
run: npm run build
- name: Publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access public