@@ -13,6 +13,33 @@ concurrency:
1313 group : ${{ github.head_ref || github.run_id }}
1414 cancel-in-progress : true
1515jobs :
16+ verify-version :
17+ if : startsWith(github.ref, 'refs/tags/')
18+ runs-on : ubuntu-latest
19+ steps :
20+ - uses : actions/checkout@v6
21+ - name : Verify tag version matches package.json
22+ run : |
23+ # Extract tag name from GITHUB_REF (e.g., refs/tags/v6.0.2 -> v6.0.2)
24+ TAG_NAME="${GITHUB_REF#refs/tags/}"
25+ # Remove 'v' prefix if present to get the version number
26+ TAG_VERSION="${TAG_NAME#v}"
27+
28+ # Get version from package.json
29+ PACKAGE_VERSION=$(node -p "require('./package.json').version")
30+
31+ echo "Tag version: $TAG_VERSION"
32+ echo "Package version: $PACKAGE_VERSION"
33+
34+ if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then
35+ echo "ERROR: Tag version ($TAG_VERSION) does not match package.json version ($PACKAGE_VERSION)"
36+ echo "Please update package.json or create a new tag with the correct version"
37+ echo "GitHub release will NOT be created."
38+ exit 1
39+ fi
40+
41+ echo "Version match verified!"
42+
1643 build :
1744 runs-on : ${{ matrix.os }}
1845 strategy :
@@ -163,3 +190,23 @@ jobs:
163190 - name : Upload binaries to GitHub Release
164191 run : yarn install --ignore-scripts && yarn upload --upload-all ${{ github.token }}
165192 if : startsWith(github.ref, 'refs/tags/')
193+
194+ publish-npm :
195+ needs : [build, build-musl]
196+ if : startsWith(github.ref, 'refs/tags/')
197+ runs-on : ubuntu-latest
198+ permissions :
199+ contents : read
200+ id-token : write
201+ steps :
202+ - uses : actions/checkout@v6
203+ - uses : actions/setup-node@v6
204+ with :
205+ node-version : 24
206+ registry-url : https://registry.npmjs.org
207+
208+ - name : Install dependencies
209+ run : yarn install --ignore-scripts
210+
211+ - name : Publish to npm
212+ run : npm publish
0 commit comments