Repository navigation
ci: npm Trusted Publishing으로 전환 (토큰 제거) #13
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,30 @@ | ||
| name: publish | ||
| # GitHub Release를 publish하면 npm에 배포한다. NPM_TOKEN 시크릿 필요. | ||
| # GitHub Release를 publish하면 npm에 배포한다. | ||
| # 인증은 npm Trusted Publishing(OIDC) — 장기 토큰(NPM_TOKEN) 없이 단기 토큰으로 배포하며 | ||
| # provenance도 자동 생성된다. npm 쪽 패키지 설정에 이 저장소·워크플로가 등록돼 있어야 한다. | ||
| on: | ||
| release: | ||
| types: [published] | ||
|
|
||
| permissions: | ||
| contents: read | ||
| id-token: write # npm provenance(OIDC)에 필요 | ||
| id-token: write # OIDC 토큰 발급에 필요 | ||
|
|
||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-latest | ||
| runs-on: ubuntu-latest # Trusted Publishing은 GitHub-hosted 러너만 지원 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: false # 배포에 repo 자격증명이 필요 없다 — git config에 남기지 않는다 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| node-version: 24 # OIDC 요구: node 22.14+ / npm 11.5.1+ | ||
|
jeongph marked this conversation as resolved.
|
||
| registry-url: https://registry.npmjs.org | ||
| # setup-node가 .npmrc에 남기는 _authToken placeholder가 OIDC 인증과 충돌할 수 있어 | ||
| # Trusted Publishing을 지원하는 npm으로 고정한다(11.5.1+). id-token 권한이 있는 job이므로 | ||
| # 가변 태그(@latest) 대신 버전을 핀하고 설치 스크립트도 실행하지 않는다 | ||
| - run: npm install -g --ignore-scripts npm@11.8.0 | ||
| - run: npm ci | ||
| - run: npm test | ||
| - run: npm publish --provenance | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
| - run: npm publish | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.