From ca452644ff1d3ea1b1ef26c07558453effa8829b Mon Sep 17 00:00:00 2001 From: MrCoder Date: Tue, 17 Dec 2024 16:39:29 +1100 Subject: [PATCH] ci: transfer git tag creation to GitHub Actions workflow - Remove git tag creation from bump-version.js script - Add git tag creation steps to CD workflow in GitHub Actions - Update version output format in bump-version.js --- .github/workflows/cd.yml | 6 ++++++ scripts/bump-version.js | 6 +----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 80e1e55b..fc4e6f12 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -69,6 +69,12 @@ jobs: run: npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} + - name: Create git tag + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git tag "v${{ steps.bump.outputs.version }}" + git push origin "v${{ steps.bump.outputs.version }}" # Build the site for embed view and other demo build-site: diff --git a/scripts/bump-version.js b/scripts/bump-version.js index b2c4eece..8165328b 100755 --- a/scripts/bump-version.js +++ b/scripts/bump-version.js @@ -102,13 +102,9 @@ const run = async () => { JSON.stringify(pkg, null, 2) + "\n", ); - // Create git tag - execSync(`git tag v${newVersion}`); - console.log(`\nCreated git tag: v${newVersion}`); - // Set output for GitHub Actions if (process.env.GITHUB_ACTIONS) { - fs.appendFileSync(process.env.GITHUB_OUTPUT, `version=v${newVersion}\n`); + fs.appendFileSync(process.env.GITHUB_OUTPUT, `version=${newVersion}\n`); } } else { console.log("\nDRY RUN: No changes were made");