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 to npm
2+
3+ on :
4+ push :
5+ branches : [main]
6+
7+ jobs :
8+ publish :
9+ runs-on : ubuntu-latest
10+ environment : npm-publish
11+ permissions :
12+ id-token : write
13+ contents : read
14+ steps :
15+ - uses : actions/checkout@v4
16+
17+ - uses : actions/setup-node@v4
18+ with :
19+ node-version : ' 22'
20+ registry-url : ' https://registry.npmjs.org'
21+
22+ - name : Check whether package.json version is already published
23+ id : check
24+ run : |
25+ LOCAL=$(node -p "require('./package.json').version")
26+ PUBLISHED=$(npm view @todesktop/az-vm version 2>/dev/null || echo "none")
27+ echo "local=$LOCAL"
28+ echo "published=$PUBLISHED"
29+ if [ "$LOCAL" != "$PUBLISHED" ]; then
30+ echo "should_publish=true" >> "$GITHUB_OUTPUT"
31+ else
32+ echo "should_publish=false" >> "$GITHUB_OUTPUT"
33+ fi
34+
35+ - name : Upgrade npm (trusted publishing requires npm >= 11.5.1)
36+ if : steps.check.outputs.should_publish == 'true'
37+ run : npm install -g npm@latest
38+
39+ - name : Publish
40+ if : steps.check.outputs.should_publish == 'true'
41+ run : npm publish --access public --provenance
Original file line number Diff line number Diff line change 11{
22 "name" : " @todesktop/az-vm" ,
3- "version" : " 1.0.0 " ,
3+ "version" : " 1.0.1 " ,
44 "description" : " Quick and easy Azure VM creation CLI tool supporting Windows and Linux VMs" ,
55 "main" : " create-az-vm.js" ,
66 "bin" : {
You can’t perform that action at this time.
0 commit comments