-
-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (36 loc) · 1.05 KB
/
publish.yml
File metadata and controls
44 lines (36 loc) · 1.05 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: Publish to npm
on:
push:
tags:
- "v*"
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
- name: Enable corepack (pnpm)
run: corepack enable
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Show git status before publish
run: |
git status --short
git diff --stat
- name: Verify tag matches package.json version
run: |
TAG="${GITHUB_REF_NAME}"
PKG_VERSION="$(node -p "require('./package.json').version")"
if [ "v${PKG_VERSION}" != "${TAG}" ]; then
echo "::error::Tag ${TAG} does not match package.json version v${PKG_VERSION}"
exit 1
fi
- name: Publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access public