From b477746356abf6cb726fe52f5fa672e5f861947d Mon Sep 17 00:00:00 2001 From: Miraculous Ladybugreport <3642643+PeyTy@users.noreply.github.com> Date: Mon, 4 Dec 2023 20:54:06 +0200 Subject: [PATCH] Script to update version --- .github/workflows/building-bundle.yml | 1 + tagToVersion.js | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 tagToVersion.js diff --git a/.github/workflows/building-bundle.yml b/.github/workflows/building-bundle.yml index a287908..c2d0309 100644 --- a/.github/workflows/building-bundle.yml +++ b/.github/workflows/building-bundle.yml @@ -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 }} diff --git a/tagToVersion.js b/tagToVersion.js new file mode 100644 index 0000000..d7be52d --- /dev/null +++ b/tagToVersion.js @@ -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")