Skip to content

Commit

Permalink
Script to update version
Browse files Browse the repository at this point in the history
  • Loading branch information
PeyTy committed Dec 4, 2023
1 parent 652e832 commit b477746
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/building-bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ jobs:
- name: Publish Hexa VSCode bundle
if: github.event_name == 'release' && github.event.action == 'created'
run: |
node tagToVersion.js ${{ github.ref_name }}
npx vsce publish
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
12 changes: 12 additions & 0 deletions tagToVersion.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const fs = require('fs')
const ref = process.argv.pop().trim()
const tag = ref.split('v').pop()
console.log({ref, tag })

function update(file, pattern) {
const json = fs.readFileSync(file).toString()
fs.writeFileSync(file, json.split(pattern).join(tag))
}

update('package.json', "0.2.1")
update('package-lock.json', "0.1.2")

0 comments on commit b477746

Please sign in to comment.