File tree Expand file tree Collapse file tree 1 file changed +54
-0
lines changed
Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ name : Publish to npm
3+
4+ on :
5+ release :
6+ types :
7+ - published
8+ workflow_dispatch :
9+
10+ concurrency :
11+ group : ${{ github.workflow }}-${{ github.event.release.tag_name || github.ref }}
12+ cancel-in-progress : true
13+
14+ jobs :
15+ publish :
16+ name : Publish Package
17+ runs-on : [self-hosted, macOS]
18+ permissions :
19+ contents : read
20+ steps :
21+ - name : Checkout Repository
22+ uses : actions/checkout@v6
23+ with :
24+ clean : true
25+ ref : ${{ github.event.release.tag_name || github.ref }}
26+
27+ - name : Setup Node.js
28+ uses : actions/setup-node@v4
29+ with :
30+ node-version : 22
31+ cache : npm
32+ registry-url : https://registry.npmjs.org
33+
34+ - name : Install Dependencies
35+ run : npm ci
36+
37+ - name : Run Tests
38+ run : npm test
39+
40+ - name : Verify Release Tag Matches package.json
41+ if : github.event_name == 'release'
42+ run : |
43+ PACKAGE_VERSION="$(node -p "require('./package.json').version")"
44+ RELEASE_TAG="${{ github.event.release.tag_name }}"
45+
46+ if [ "$PACKAGE_VERSION" != "$RELEASE_TAG" ]; then
47+ echo "Release tag $RELEASE_TAG does not match package.json version $PACKAGE_VERSION"
48+ exit 1
49+ fi
50+
51+ - name : Publish Package
52+ run : npm publish --access public
53+ env :
54+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
You can’t perform that action at this time.
0 commit comments