Skip to content

Commit cdb2ff8

Browse files
✨ feat(ci): Enhance npm publish workflow with versioning from tags
- Added a step to fetch the latest version tag from the repository and set it as an environment variable. - Implemented a step to update the package version using the fetched tag without creating a new git tag. - These changes streamline the npm publish process by ensuring the package version aligns with the latest release tag.
1 parent 97e83e4 commit cdb2ff8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.github/workflows/npm-publish.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,16 @@ jobs:
3232
with:
3333
node-version: 20
3434
registry-url: https://registry.npmjs.org/
35+
- name: Get New Version from release
36+
run: |
37+
git fetch --tags
38+
NEW_VERSION=$(git describe --tags --abbrev=0)
39+
echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_ENV
3540
- name: Install Dependencies 📦
3641
run: npm install
42+
- name: Update Package Version 📝
43+
run: npm version ${NEW_VERSION} --no-git-tag-version
3744
- name: Publish Core Package 🚀
3845
run: npm publish --access public
3946
env:
40-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
47+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

0 commit comments

Comments
 (0)