Skip to content

ci: tokenless OIDC trusted publishing via npm (bun pm pack)#21

Merged
amondnet merged 2 commits into
mainfrom
fix/npm-trusted-publish
Jun 1, 2026
Merged

ci: tokenless OIDC trusted publishing via npm (bun pm pack)#21
amondnet merged 2 commits into
mainfrom
fix/npm-trusted-publish

Conversation

@amondnet
Copy link
Copy Markdown
Contributor

@amondnet amondnet commented Jun 1, 2026

문제

publish job이 bun publish: error: missing authentication으로 실패합니다 (failing run).

bun publishnpm OIDC trusted publishing도, --provenance도 지원하지 않습니다 (oven-sh/bun#22423, #24855).

변경 — tokenless OIDC trusted publishing

발행 도구를 npm CLI로 전환하고, 장기 토큰(NPM_TOKEN) 없이 OIDC로만 인증합니다:

  • bun pm pack으로 tarball 생성 → npm publish *.tgz --provenance --access public으로 업로드
  • publish job에 permissions: id-token: write → npm이 OIDC 토큰을 발급받아 인증 (장기 토큰 불필요)
  • actions/setup-node(registry-url)가 레지스트리 .npmrc 구성
  • OIDC trusted publishing 최소 요구 버전인 npm ≥ 11.5.1 보장 스텝 추가
  • npm view 가드로 멱등성 확보 (이미 발행된 버전 skip → 재실행 안전)
  • 누락됐던 @pleaseai/code-style(cli) 발행 스텝 추가 — manifest는 0.0.3을 추적하지만 npm은 0.0.1에 멈춰 있었음
  • NODE_AUTH_TOKEN/NPM_TOKEN 시크릿 의존성 완전 제거

⚠️ 머지 전 필수 선행 작업 (npmjs.com에서)

tokenless OIDC는 npm 레지스트리에 trusted publisher가 설정돼 있어야 동작합니다. 각 발행 패키지마다 npmjs.com → Settings → Trusted Publishers에서 다음을 등록해야 합니다:

패키지 Repository Workflow
@pleaseai/eslint-config pleaseai/code-style release-please.yml
@pleaseai/prettier-config pleaseai/code-style release-please.yml
@pleaseai/code-style pleaseai/code-style release-please.yml

미설정 상태로 머지하면 publish 스텝이 OIDC 인증 단계에서 실패합니다. (이 설정은 repo 권한으로는 불가하며 npm 패키지 소유자가 직접 해야 합니다.)

@pleaseai/prettier-config는 아직 npm 미발행 상태라, 첫 발행은 패키지 소유자가 일회성으로 trusted publisher를 미리 등록해 둬야 합니다(빈 패키지에도 등록 가능).

검증

  • YAML 유효성 통과 / bun pm pack --dry-run tarball 이름 확인 (pleaseai-eslint-config-<ver>.tgz 등 glob 매칭)
  • 워크플로우는 main push 시에만 동작하므로 이 PR 자체로는 발행 실행 안 됨 (PR CI는 lint만 검증)
  • @pleaseai/editorconfigprivate: true → 발행 대상 아님

bun publish supports neither npm OIDC trusted publishing nor
--provenance (oven-sh/bun#22423), so the publish job failed with
'missing authentication'. Switch the publisher to the npm CLI:

- bun pm pack builds the tarball, npm publish --provenance uploads it
- actions/setup-node provisions the registry .npmrc + an npm new
  enough for provenance; id-token: write grants the OIDC token
- npm view guards make the job idempotent (skip already-published vers)
- add the missing @pleaseai/code-style (cli) publish step — it was
  stuck at 0.0.1 on npm while the manifest tracks 0.0.3
@gemini-code-assist
Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Jun 1, 2026

Deploying code-style with  Cloudflare Pages  Cloudflare Pages

Latest commit: d3a842c
Status:⚡️  Build in progress...

View logs

Authenticate to npm purely via OIDC: id-token: write mints the token,
a trusted publisher configured on npmjs.com authorizes it. Removes the
NODE_AUTH_TOKEN/NPM_TOKEN secret entirely.

- ensure npm >= 11.5.1 (OIDC trusted-publishing minimum) before publish
- no long-lived registry token in CI
@amondnet amondnet changed the title ci: publish via npm (bun pm pack) for provenance/trusted publishing ci: tokenless OIDC trusted publishing via npm (bun pm pack) Jun 1, 2026
@amondnet amondnet self-assigned this Jun 1, 2026
@amondnet amondnet merged commit 5d554eb into main Jun 1, 2026
1 of 2 checks passed
@amondnet amondnet deleted the fix/npm-trusted-publish branch June 1, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant