Skip to content

Commit d2b5954

Browse files
authored
Merge pull request #2 from ToDesktop/claude/add-npm-publish-workflow
Add npm publish workflow and bump version to 1.0.1
2 parents 4b4c800 + bcc5cd5 commit d2b5954

2 files changed

Lines changed: 42 additions & 1 deletion

File tree

.github/workflows/publish.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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": {

0 commit comments

Comments
 (0)