Repository navigation
66 lines (53 loc) · 1.81 KB
/
Copy pathrelease.yml
File metadata and controls
66 lines (53 loc) · 1.81 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Release
on:
release:
types: [published]
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
permissions: {}
jobs:
publish:
name: Publish to npm (staged, OIDC)
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Verify tag matches package.json version
env:
REF_NAME: ${{ github.ref_name }}
run: |
set -euo pipefail
tag_version="${REF_NAME#v}"
pkg_version="$(node -p "require('./package.json').version")"
if [ "$tag_version" != "$pkg_version" ]; then
echo "::error::Release tag '$REF_NAME' does not match package.json version '$pkg_version'"
exit 1
fi
echo "Tag and package.json agree on version $pkg_version"
- name: Setup Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "24"
registry-url: "https://registry.npmjs.org"
package-manager-cache: false
- name: Ensure npm CLI supports trusted publishing
run: npm install -g npm@latest
- name: Install dependencies (no lifecycle scripts)
run: bun install --frozen-lockfile --ignore-scripts
- name: Type check
run: bun run typecheck
- name: Run tests
run: bun run test
- name: Build
run: bun run build
- name: Stage publish to npm with provenance
run: npm stage publish --provenance --access public