File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : publish
2+
3+ on :
4+ push :
5+ tags :
6+ - ' v*'
7+
8+ permissions :
9+ contents : read
10+ id-token : write
11+
12+ concurrency :
13+ group : publish
14+ cancel-in-progress : false
15+
16+ jobs :
17+ publish :
18+ runs-on : ubuntu-latest
19+ steps :
20+ - name : Extract version from tag
21+ id : version
22+ run : |
23+ VERSION="${GITHUB_REF#refs/tags/v}"
24+ if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+|-beta\.[0-9]+)?$'; then
25+ echo "Error: tag must be vX.Y.Z format, got: $GITHUB_REF"
26+ exit 1
27+ fi
28+ echo "Releasing version: $VERSION"
29+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
30+
31+ - name : Checkout
32+ uses : actions/checkout@v4
33+
34+ - name : Check version
35+ run : |
36+ VERSION="${{ steps.version.outputs.version }}"
37+ ACTUAL=$(grep -m1 '"version"' package.json | sed -E 's/.*"version": "([^"]*)".*/\1/')
38+ if [ "$ACTUAL" != "$VERSION" ]; then
39+ echo "Error: package.json has version $ACTUAL but tag is v$VERSION"
40+ exit 1
41+ fi
42+ echo "OK: package.json = $ACTUAL"
43+
44+ - name : Setup Node
45+ uses : actions/setup-node@v4
46+ with :
47+ node-version : 24
48+ registry-url : ' https://registry.npmjs.org'
49+
50+ - name : Install dependencies
51+ run : npm ci
52+
53+ - name : Build
54+ run : npm run build
55+
56+ - name : Publish to npm
57+ run : npm publish --provenance --no-git-checks
Original file line number Diff line number Diff line change 1+ 24
You can’t perform that action at this time.
0 commit comments