-
Notifications
You must be signed in to change notification settings - Fork 0
ci: release to npm on tag push (trusted publishing, mirrors kernel/cua) #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - "v*" | ||
|
|
||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
|
|
||
| concurrency: | ||
| group: release-${{ github.ref_name }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 20 | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Verify tag is on main | ||
| run: | | ||
| git fetch origin main:refs/remotes/origin/main | ||
| git merge-base --is-ancestor "$GITHUB_SHA" origin/main | ||
|
|
||
| - uses: actions/setup-node@v5 | ||
| with: | ||
| node-version: 24 | ||
| registry-url: https://registry.npmjs.org | ||
|
|
||
| - name: Ensure npm supports trusted publishing | ||
| run: npm install -g npm@^11.5.1 | ||
|
|
||
| - run: npm ci | ||
|
|
||
| - name: Verify package version matches tag | ||
| run: | | ||
| node --input-type=module <<'EOF' | ||
| import { readFileSync } from "node:fs"; | ||
|
|
||
| const tag = process.env.GITHUB_REF_NAME; | ||
| const prefix = "v"; | ||
| if (!tag?.startsWith(prefix)) { | ||
| throw new Error(`Expected tag to start with ${prefix}, got ${tag}`); | ||
| } | ||
|
|
||
| const tagVersion = tag.slice(prefix.length); | ||
| const pkg = JSON.parse(readFileSync("package.json", "utf8")); | ||
| if (pkg.version !== tagVersion) { | ||
| throw new Error(`Tag version ${tagVersion} does not match ${pkg.name} package.json version ${pkg.version}`); | ||
| } | ||
|
|
||
| console.log(`${pkg.name}@${pkg.version}`); | ||
| EOF | ||
|
|
||
| - run: npm run build | ||
| - run: npm run typecheck | ||
|
|
||
| - name: Pack tarball | ||
| run: npm pack --pack-destination "$RUNNER_TEMP" | ||
|
|
||
| - name: ESM import smoke test | ||
| run: | | ||
| SMOKE_DIR=$(mktemp -d) | ||
| cd "$SMOKE_DIR" | ||
| npm init -y > /dev/null | ||
| npm install "$RUNNER_TEMP"/onkernel-eve-extension-*.tgz eve@^0.25 | ||
| node --input-type=module -e "import('@onkernel/eve-extension').then((m) => { if (typeof m.default !== 'function') process.exit(1); })" | ||
|
|
||
| - name: Publish to npm | ||
| run: npm publish --access public | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OIDC publish blocked by registry-urlHigh Severity The Reviewed by Cursor Bugbot for commit 0fead09. Configure here. |
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First publish impossible via OIDC
High Severity
The workflow authenticates only via trusted publishing OIDC and never wires
NODE_AUTH_TOKEN/NPM_TOKEN. npm still cannot publish the initial version of a package that does not exist yet over OIDC, and this package is not on npm, so the first release cannot succeed.Additional Locations (1)
.github/workflows/release.yml#L73-L75Reviewed by Cursor Bugbot for commit 0fead09. Configure here.