-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (36 loc) · 1.06 KB
/
publish.yml
File metadata and controls
44 lines (36 loc) · 1.06 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
name: Release to npm
on:
push:
branches: [main]
paths:
- "package.json"
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version-file: .node-version
registry-url: "https://registry.npmjs.org/"
- name: Install dependencies
run: npm ci
- name: Compare package version
id: version_check
run: |
VERSION=$(jq -r '.version' package.json)
PREV_VERSION=$(git show HEAD~1:package.json | jq -r '.version')
echo "current=$VERSION" >> "$GITHUB_OUTPUT"
echo "previous=$PREV_VERSION" >> "$GITHUB_OUTPUT"
if [ "$VERSION" = "$PREV_VERSION" ]; then
echo "No version change. Skipping publish."
exit 0
fi
- name: Build
run: npm run build
- name: Publish to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}