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 package
2+
3+ on :
4+ release :
5+ types :
6+ - published
7+ workflow_dispatch :
8+ inputs :
9+ version :
10+ description : " Package version to publish, without a leading v"
11+ required : true
12+ type : string
13+
14+ permissions :
15+ contents : read
16+ id-token : write
17+
18+ jobs :
19+ publish :
20+ runs-on : ubuntu-latest
21+ steps :
22+ - name : Checkout
23+ uses : actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
24+
25+ - name : Set up Node
26+ uses : actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
27+ with :
28+ node-version : " 22.14.0"
29+ registry-url : " https://registry.npmjs.org"
30+
31+ - name : Install npm 11
32+ run : npm install --global npm@11
33+
34+ - name : Install dependencies
35+ run : npm ci
36+
37+ - name : Verify release version
38+ env :
39+ EXPECTED_VERSION : ${{ github.event.release.tag_name || inputs.version }}
40+ run : |
41+ package_version="$(node -p "require('./package.json').version")"
42+ expected_version="${EXPECTED_VERSION#v}"
43+
44+ if [ "$package_version" != "$expected_version" ]; then
45+ echo "Package version $package_version does not match release version $expected_version"
46+ exit 1
47+ fi
48+
49+ - name : Publish to npm
50+ run : npm publish --access public
You can’t perform that action at this time.
0 commit comments