Skip to content

Commit b0f2d01

Browse files
committed
Update NPM publish workflow to improve versioning and build process
1 parent 755942b commit b0f2d01

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

.github/workflows/npm-publish.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "NPM Publish"
1+
name: "Release New Version"
22

33
on:
44
workflow_dispatch:
@@ -24,28 +24,25 @@ jobs:
2424
- name: "Install dependencies"
2525
run: npm ci
2626

27-
- name: "Clean untracked files"
28-
run: git clean -fdx
27+
- name: "Build package"
28+
run: npm run build
2929

3030
- name: "Set Git user name and email"
3131
run: |
3232
git config --global user.name "github-actions"
3333
git config --global user.email "[email protected]"
3434
35-
- name: "Bump patch version"
36-
run: npm version patch
37-
38-
- name: "Get new version"
35+
- name: "Get version"
3936
id: get_version
4037
run: echo "version=v$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
4138

42-
- name: "Push version bump commit and tag"
39+
- name: "Push tags"
4340
run: |
44-
git push origin HEAD
41+
git tag ${{ steps.get_version.outputs.version }}
4542
git push origin --tags
4643
4744
- name: "Publish to NPM"
48-
run: npm publish
45+
run: npm publish --access public
4946
env:
5047
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5148

0 commit comments

Comments
 (0)