Skip to content

Commit 0eb70ef

Browse files
that-github-userunknownclaude
authored
Add npm publish workflow and prepublish build step (#42)
- prepublishOnly script: builds + tests before npm publish - files field: only includes dist/, README.md, LICENSE in package - GitHub Actions release workflow: triggers on v* tags, publishes to npm with provenance, creates GitHub Release with auto-generated notes Closes #28 Co-authored-by: unknown <that-github-user@github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 28e646f commit 0eb70ef

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
id-token: write
11+
12+
jobs:
13+
release:
14+
name: Build & Publish
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Use Node.js 22
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 22
24+
cache: npm
25+
registry-url: https://registry.npmjs.org/
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Lint
31+
run: npm run lint
32+
33+
- name: Build
34+
run: npm run build
35+
36+
- name: Test
37+
run: npm test
38+
39+
- name: Publish to npm
40+
run: npm publish --provenance --access public
41+
env:
42+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
43+
44+
- name: Create GitHub Release
45+
uses: softprops/action-gh-release@v2
46+
with:
47+
generate_release_notes: true

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"build": "tsc",
1111
"dev": "tsx src/cli.ts",
1212
"test": "tsx --test src/**/*.test.ts",
13+
"prepublishOnly": "npm run build && npm test",
1314
"lint": "biome check src/",
1415
"lint:fix": "biome check --write src/",
1516
"format": "biome format --write src/"
@@ -24,6 +25,11 @@
2425
],
2526
"author": "",
2627
"license": "MIT",
28+
"files": [
29+
"dist",
30+
"README.md",
31+
"LICENSE"
32+
],
2733
"dependencies": {
2834
"commander": "^14.0.3"
2935
},

0 commit comments

Comments
 (0)