Skip to content

Commit 49145eb

Browse files
committed
added updating of version during build
1 parent 135e629 commit 49145eb

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

.github/workflows/build-deploy.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,29 @@ jobs:
3737
- uses: actions/setup-node@v2
3838
with:
3939
node-version: 16.19.0
40+
41+
# Update package.json with the new version number
42+
- name: Update package.json
43+
uses:
44+
actions/github-script@v5
45+
with:
46+
github-token: ${{ secrets.GITHUB_TOKEN }}
47+
script: |
48+
const fs = require('fs');
49+
const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
50+
packageJson.version = '${{ github.event.inputs.tag }}';
51+
fs.writeFileSync('./package.json', JSON.stringify(packageJson, null, 2));
52+
53+
# Push the change to the main branch
54+
- name: Push changes to main
55+
run: |
56+
git config --local user.email "[email protected]"
57+
git config --local user.name "Daman Dhillon"
58+
git add package.json
59+
git commit -m "Update package.json with version ${{ github.event.inputs.tag }}"
60+
git push
61+
62+
4063
# Install dependencies
4164
- run: npm install
4265
- run: npm install -g vsce
@@ -90,4 +113,5 @@ jobs:
90113
upload_url: ${{ steps.create_release.outputs.upload_url }}
91114
asset_path: ./commit-extension-${{ github.event.inputs.tag }}.vsix
92115
asset_name: commit-extension-${{ github.event.inputs.tag }}.vsix
93-
asset_content_type: application/zip
116+
asset_content_type: application/zip
117+

0 commit comments

Comments
 (0)