Skip to content

Commit 0635d8b

Browse files
committed
[ADD] a step to dynamically update the package's version when building
1 parent 8e756f1 commit 0635d8b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

.github/workflows/publish_vsix.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,25 @@ jobs:
3737
with:
3838
node-version: 24
3939

40+
- name: Set package.json version from tag
41+
run: |
42+
TAG_VERSION="${GITHUB_REF##refs/tags/}"
43+
echo "Tag version: $TAG_VERSION"
44+
45+
node <<'EOF'
46+
const fs = require('fs');
47+
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
48+
49+
const tagVersion = process.env.TAG_VERSION;
50+
51+
// Update version in package.json
52+
pkg.version = tagVersion;
53+
54+
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
55+
EOF
56+
env:
57+
TAG_VERSION: ${{ github.ref }}
58+
4059
- name: Adjust package.json for matrix target
4160
run: |
4261
node <<'EOF'

0 commit comments

Comments
 (0)