Skip to content

Commit 76ef33d

Browse files
authored
Enhance release workflow with version bumping
Updated release workflow to include version bumping and commit changes.
1 parent d0e63d6 commit 76ef33d

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

.github/workflows/release.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3-
41
name: NPM Publish
52

63
on:
@@ -9,7 +6,7 @@ on:
96

107
permissions:
118
id-token: write # Required for OIDC
12-
contents: read
9+
contents: write # Required for pushing version bump commit
1310

1411
jobs:
1512
publish-npm:
@@ -21,7 +18,16 @@ jobs:
2118
node-version: 22
2219
registry-url: https://registry.npmjs.org/
2320
- run: npm install -g npm@latest
24-
- run: npm ci --ignore-scripts --no-fund --no-audit
21+
- run: npm install --ignore-scripts --no-audit --no-fund
22+
- name: Bump version from release tag
23+
run: |
24+
VERSION=${GITHUB_REF_NAME#v}
25+
npm version $VERSION --no-git-tag-version
26+
git config user.name "github-actions[bot]"
27+
git config user.email "github-actions[bot]@users.noreply.github.com"
28+
git add package.json package-lock.json
29+
git commit -m "chore: bump version to $VERSION"
30+
git push origin HEAD:${{ github.event.repository.default_branch }}
2531
- run: npm test
2632
- run: npm run build
2733
- run: npm publish --access public

0 commit comments

Comments
 (0)