-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (61 loc) · 2.22 KB
/
Copy pathbootstrap-publish.yml
File metadata and controls
65 lines (61 loc) · 2.22 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
name: Bootstrap first npm release
on:
workflow_dispatch:
inputs:
confirm_package:
description: Type @ai-router/[email protected]
required: true
type: string
permissions:
contents: read
id-token: write
concurrency:
group: npm-bootstrap-publish
cancel-in-progress: false
jobs:
publish:
name: Publish the brand-new package once
runs-on: ubuntu-latest
timeout-minutes: 15
environment: npm-bootstrap
steps:
- name: Confirm the immutable target
env:
CONFIRM_PACKAGE: ${{ inputs.confirm_package }}
run: test "$CONFIRM_PACKAGE" = "@ai-router/[email protected]"
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 24
registry-url: https://registry.npmjs.org/
cache: npm
- name: Use an npm CLI with provenance support
run: npm install --global npm@11
- name: Verify bootstrap token authentication
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_BOOTSTRAP_TOKEN }}
run: |
test -n "$NODE_AUTH_TOKEN"
publisher="$(npm whoami --registry=https://registry.npmjs.org/)"
test -n "$publisher"
echo "Authenticated npm username: $publisher"
if [ "$publisher" != "ai-router" ]; then
echo "::error::The authenticated npm username is not ai-router, so it cannot own the @ai-router user scope."
exit 1
fi
echo "npm token authentication and @ai-router user-scope ownership match."
- run: npm ci --ignore-scripts
- run: npm run validate
- run: npm audit --audit-level=high
- name: Refuse to overwrite an existing version
run: |
if npm view @ai-router/[email protected] version >/dev/null 2>&1; then
echo "Version 0.1.0 already exists; bootstrap is single-use."
exit 1
fi
- name: Publish 0.1.0 with provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_BOOTSTRAP_TOKEN }}
run: |
test -n "$NODE_AUTH_TOKEN"
npm publish --access public --provenance