Skip to content

Commit ed7a70c

Browse files
committed
ci: add npm publish workflow
1 parent d73f2d7 commit ed7a70c

3 files changed

Lines changed: 49 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
publish-npm:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: 20
20+
registry-url: https://registry.npmjs.org
21+
22+
- name: Run tests
23+
run: node --test scripts/tests/*.test.cjs
24+
25+
- name: Verify release tag matches package version
26+
if: github.event_name == 'release'
27+
env:
28+
RELEASE_TAG: ${{ github.event.release.tag_name }}
29+
run: |
30+
PACKAGE_VERSION="$(node -p "require('./package.json').version")"
31+
TAG_VERSION="${RELEASE_TAG#v}"
32+
33+
if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then
34+
echo "package.json version $PACKAGE_VERSION does not match release tag $RELEASE_TAG"
35+
exit 1
36+
fi
37+
38+
- name: Publish to npm
39+
env:
40+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
41+
run: npm publish --access public

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
- GitHub Actions npm publish workflow on release publish or manual dispatch, with version/tag verification before `npm publish`
12+
1013
## [3.0.4] — 2026-03-11
1114

1215
### Added

handoff.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
- The structured-output migration plan is effectively complete; the remaining
2525
follow-up is only secondary doc cleanup where old `*.md` artifact wording may
2626
still appear in historical text.
27+
- Added `.github/workflows/publish.yml` so GitHub releases can publish the npm
28+
package automatically once `NPM_TOKEN` is configured in repo secrets.
2729

2830
## Last prompts
2931

@@ -55,12 +57,15 @@ Both passed on 2026-03-11.
5557
- `docs/plans/2026-03-11-structured-output-migration-plan.md`
5658
- `CHANGELOG.md`
5759
- `package.json`
60+
- `.github/workflows/publish.yml`
5861

5962
## Next steps
6063

6164
- sweep remaining secondary docs for stale `*.md` phase-artifact references
6265
- decide whether `run-bug-hunter.cjs phase` should be documented in README or
6366
kept as an internal orchestration helper only
67+
- add repo secret `NPM_TOKEN`, then either rerun `v3.0.4` publish manually or
68+
wait for the next tagged GitHub release
6469

6570
## Environment
6671

0 commit comments

Comments
 (0)