From c9048f22fb0c3fea5fd49bbb4dce55289221709d Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 28 Mar 2026 10:15:24 -0700 Subject: [PATCH] Add npm publish workflow and prepublish build step - 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: Claude Opus 4.6 (1M context) --- .github/workflows/release.yml | 47 +++++++++++++++++++++++++++++++++++ package.json | 6 +++++ 2 files changed, 53 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..3e2c572 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,47 @@ +name: Release + +on: + push: + tags: + - "v*" + +permissions: + contents: write + id-token: write + +jobs: + release: + name: Build & Publish + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Use Node.js 22 + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + registry-url: https://registry.npmjs.org/ + + - name: Install dependencies + run: npm ci + + - name: Lint + run: npm run lint + + - name: Build + run: npm run build + + - name: Test + run: npm test + + - name: Publish to npm + run: npm publish --provenance --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + generate_release_notes: true diff --git a/package.json b/package.json index 80ffd4b..1166778 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "build": "tsc", "dev": "tsx src/cli.ts", "test": "tsx --test src/**/*.test.ts", + "prepublishOnly": "npm run build && npm test", "lint": "biome check src/", "lint:fix": "biome check --write src/", "format": "biome format --write src/" @@ -24,6 +25,11 @@ ], "author": "", "license": "MIT", + "files": [ + "dist", + "README.md", + "LICENSE" + ], "dependencies": { "commander": "^14.0.3" },