Skip to content

Commit 69b6991

Browse files
authored
Add workflow for npm publishing (#272)
1 parent ce6f21d commit 69b6991

2 files changed

Lines changed: 55 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Publish to npm
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Setup Node.js
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: '22'
18+
cache: 'npm'
19+
registry-url: 'https://registry.npmjs.org'
20+
21+
- name: Install dependencies
22+
run: npm ci
23+
24+
- name: Run tests
25+
run: npm test
26+
27+
- name: Build production
28+
run: npm run build prod
29+
30+
- name: Publish to npm
31+
run: npm publish
32+
env:
33+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

BUILD.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,25 @@ After cloning the repo:
1515
| `build prod` | Make a production build in `/dist` |
1616
| `test [coverage]` | Run all the tests and generate code coverage data in `/coverage` directory |
1717
| `test snapshot` | Update the test snapshots |
18+
19+
## Releasing to npm
20+
21+
This project uses GitHub Actions to automatically publish to npm when a release
22+
is created.
23+
24+
### Publishing a new version
25+
26+
1. Update the version in `package.json`
27+
2. Commit the version change: `git commit -am "Bump version to x.y.z"`
28+
3. Push to main: `git push origin main`
29+
4. Create a GitHub release:
30+
- Go to your repository → Releases → "Create a new release"
31+
- Create a new tag matching the version (e.g., `v0.30.3`)
32+
- Fill in the release title and notes
33+
- Click "Publish release"
34+
35+
The workflow will automatically:
36+
37+
- Run all tests
38+
- Build the production bundle
39+
- Publish to npm

0 commit comments

Comments
 (0)