1- name : Publish to npm + GitHub Packages
1+ name : Release
22
33on :
44 push :
55 tags :
66 - ' v*'
77
88permissions :
9- contents : write # needed for creating GitHub Releases
10- id-token : write # needed for npm provenance
11- packages : write # needed for GitHub Packages
9+ contents : write # create GitHub Releases
10+ id-token : write # npm provenance
11+ packages : write # GitHub Packages
1212
1313jobs :
14+ # ── 1. Gate: all tests must pass ─────────────────────────────────────────
1415 test :
15- name : Run tests
16+ name : Test (Node 20)
1617 runs-on : ubuntu-latest
1718 steps :
1819 - uses : actions/checkout@v4
19-
20- - name : Setup Node.js
21- uses : actions/setup-node@v4
20+ - uses : actions/setup-node@v4
2221 with :
2322 node-version : ' 20'
24-
2523 - name : Run test suite
2624 run : node test/run.js
2725
26+ # ── 2. Publish to npmjs.com ───────────────────────────────────────────────
2827 publish-npm :
29- name : Publish to npm
28+ name : Publish → npmjs.com
3029 needs : test
3130 runs-on : ubuntu-latest
3231 steps :
3332 - uses : actions/checkout@v4
34-
35- - name : Setup Node.js
36- uses : actions/setup-node@v4
33+ - uses : actions/setup-node@v4
3734 with :
3835 node-version : ' 20'
3936 registry-url : ' https://registry.npmjs.org'
@@ -46,31 +43,28 @@ jobs:
4643 echo "ERROR: package.json version ($PKG_VERSION) does not match tag ($TAG_VERSION)"
4744 exit 1
4845 fi
49- echo "Version check passed: $PKG_VERSION"
46+ echo "✓ version check passed: $PKG_VERSION"
5047
5148 - name : Publish to npm
5249 run : npm publish --provenance --access public
5350 env :
5451 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
5552
53+ # ── 3. Publish to GitHub Packages (scoped) ───────────────────────────────
5654 publish-github :
57- name : Publish to GitHub Packages
55+ name : Publish → GitHub Packages
5856 needs : test
5957 runs-on : ubuntu-latest
6058 steps :
6159 - uses : actions/checkout@v4
62-
63- - name : Setup Node.js
64- uses : actions/setup-node@v4
60+ - uses : actions/setup-node@v4
6561 with :
6662 node-version : ' 20'
6763 registry-url : ' https://npm.pkg.github.com'
6864 scope : ' @manojmallick'
6965
7066 - name : Publish to GitHub Packages
7167 run : |
72- # GitHub Packages requires a scoped name — publish as @manojmallick/sigmap
73- # without altering the canonical package.json (which stays as "sigmap" for npmjs.com)
7468 node -e "
7569 const fs = require('fs');
7670 const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
@@ -82,13 +76,47 @@ jobs:
8276 env :
8377 NODE_AUTH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
8478
79+ # ── 4. Publish VS Code extension ─────────────────────────────────────────
80+ publish-vscode :
81+ name : Publish → VS Code Marketplace
82+ needs : test
83+ runs-on : ubuntu-latest
84+ steps :
85+ - uses : actions/checkout@v4
86+ - uses : actions/setup-node@v4
87+ with :
88+ node-version : ' 20'
89+
90+ - name : Install vsce
91+ run : npm install -g @vscode/vsce
92+
93+ - name : Sync extension version with tag
94+ run : |
95+ TAG_VERSION="${GITHUB_REF_NAME#v}"
96+ node -e "
97+ const fs = require('fs');
98+ const v = process.env.TAG_VERSION;
99+ const pkg = JSON.parse(fs.readFileSync('vscode-extension/package.json', 'utf8'));
100+ pkg.version = v;
101+ fs.writeFileSync('vscode-extension/package.json', JSON.stringify(pkg, null, 2) + '\n');
102+ console.log('✓ extension version set to', v);
103+ "
104+ env :
105+ TAG_VERSION : ${{ github.ref_name }}
106+
107+ - name : Package and publish extension
108+ working-directory : vscode-extension
109+ run : vsce publish --no-dependencies
110+ env :
111+ VSCE_PAT : ${{ secrets.VSCE_PAT }}
112+
113+ # ── 5. Create GitHub Release (after all publishes succeed) ────────────────
85114 release :
86115 name : Create GitHub Release
87- needs : [publish-npm, publish-github]
116+ needs : [publish-npm, publish-github, publish-vscode ]
88117 runs-on : ubuntu-latest
89118 steps :
90119 - uses : actions/checkout@v4
91-
92120 - name : Create GitHub Release
93121 uses : softprops/action-gh-release@v2
94122 with :
0 commit comments