Skip to content

Commit 200648c

Browse files
authored
Modify npm publish workflow for main branch push
Updated the npm publish workflow to trigger on push to the main branch and added steps for version bumping and building the project.
1 parent baaa7b8 commit 200648c

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

.github/workflows/npm-publish.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish to npm
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: 20
20+
registry-url: https://registry.npmjs.org/
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Build project (optional)
26+
run: npm run build --if-present
27+
28+
- name: Bump version
29+
run: |
30+
git config --global user.name "github-actions[bot]"
31+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
32+
npm version patch -m "chore: bump version to %s [skip ci]"
33+
git push origin main --follow-tags
34+
35+
- name: Publish to npm
36+
run: npm publish --access public
37+
env:
38+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)