-
Notifications
You must be signed in to change notification settings - Fork 113
46 lines (46 loc) · 1.97 KB
/
Copy pathrelease.yaml
File metadata and controls
46 lines (46 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: release
on:
push:
tags: ['v*.*.*']
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # npm provenance
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 22
registry-url: 'https://registry.npmjs.org'
# npm trusted publishing (OIDC) requires npm >= 11.5.1; Node 22 never bundles
# that (it ships 10.9.x). Pin an EXACT version rather than floating on
# @latest: npm 12.0.0 shipped with a broken workspace symlink that pulled the
# wrong `sigstore` dependency into its own release tarball, so every
# `npm publish --provenance` failed with `Cannot find module 'sigstore'`
# (npm/cli#9722) — this is exactly what our v0.2.0 and v0.3.0 release.yaml
# runs hit, both AFTER `npm install -g npm@latest` reported success. Fixed
# in 12.0.1 (2026-07-10); bump this pin deliberately, never float it again.
- run: npm install -g npm@11.6.2
- run: npm ci
- run: npm run lint
- run: npm run typecheck
- run: npm run format:check
- run: npm run test:coverage
- run: npm run build
# Auth via npm trusted publishing (OIDC) — no token needed; provenance is
# implied. A prerelease tag (e.g. v0.3.0-rc.1, contains "-") must publish
# under an explicit dist-tag: current npm already refuses an implicit
# `latest` for a prerelease version, but failing mid-release is worse than
# not needing the guard, so this still passes --tag itself rather than
# relying on that enforcement alone.
- name: Publish
env:
REF_NAME: ${{ github.ref_name }}
run: |
if [[ "$REF_NAME" == *-* ]]; then
npm publish --provenance --access public --tag next
else
npm publish --provenance --access public
fi