Skip to content

Commit

Permalink
ci: transfer git tag creation to GitHub Actions workflow
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
MrCoder committed Dec 17, 2024
1 parent 7009f91 commit ca45264
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 1 addition & 5 deletions scripts/bump-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit ca45264

Please sign in to comment.