|
| 1 | +# Manual npm release for @ui4ai/light-input. |
| 2 | +# |
| 3 | +# Trigger from the Actions tab (workflow_dispatch). It runs the FULL check suite first and only |
| 4 | +# publishes if every check passes, so a broken tree can never ship. |
| 5 | +# |
| 6 | +# One-time setup required in the repo settings: |
| 7 | +# • Secret NPM_TOKEN — an npm automation/granular token with publish rights to the |
| 8 | +# @ui4ai scope (Settings → Secrets and variables → Actions → New repository secret). |
| 9 | +# • The workflow publishes with --provenance, which needs the `id-token: write` permission |
| 10 | +# granted below and a runner on npm ≥ 9.5 (Node 24 ships a newer npm — fine). |
| 11 | +# |
| 12 | +# Versioning is manual: bump `version` in package.json (e.g. `npm version minor`) and push before |
| 13 | +# running this. The publish step is idempotent-safe — npm refuses to republish an existing version, |
| 14 | +# so a re-run after a partial failure will not double-publish. |
| 15 | +name: Release |
| 16 | + |
| 17 | +on: |
| 18 | + workflow_dispatch: |
| 19 | + inputs: |
| 20 | + dry-run: |
| 21 | + description: 'Run npm publish with --dry-run only (no upload)' |
| 22 | + type: boolean |
| 23 | + default: false |
| 24 | + |
| 25 | +concurrency: |
| 26 | + group: release |
| 27 | + cancel-in-progress: false |
| 28 | + |
| 29 | +jobs: |
| 30 | + # Reuse the exact CI gate. Publishing is blocked unless this succeeds. |
| 31 | + checks: |
| 32 | + name: Checks |
| 33 | + uses: ./.github/workflows/checks.yml |
| 34 | + |
| 35 | + publish: |
| 36 | + name: Publish to npm |
| 37 | + needs: checks |
| 38 | + runs-on: ubuntu-latest |
| 39 | + permissions: |
| 40 | + contents: read |
| 41 | + id-token: write # required for npm provenance |
| 42 | + |
| 43 | + steps: |
| 44 | + - name: Checkout |
| 45 | + uses: actions/checkout@v6 |
| 46 | + |
| 47 | + - name: Setup Node |
| 48 | + uses: actions/setup-node@v6 |
| 49 | + with: |
| 50 | + node-version: 24 |
| 51 | + registry-url: https://registry.npmjs.org |
| 52 | + cache: npm |
| 53 | + |
| 54 | + - name: Install dependencies |
| 55 | + run: npm ci |
| 56 | + |
| 57 | + # `prepublishOnly` (check + test + package) runs automatically as part of `npm publish`, |
| 58 | + # building dist/ and re-validating before anything is uploaded. |
| 59 | + - name: Publish (dry run) |
| 60 | + if: ${{ inputs.dry-run }} |
| 61 | + run: npm publish --provenance --access public --dry-run |
| 62 | + env: |
| 63 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 64 | + |
| 65 | + - name: Publish |
| 66 | + if: ${{ !inputs.dry-run }} |
| 67 | + run: npm publish --provenance --access public |
| 68 | + env: |
| 69 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
0 commit comments