-
Notifications
You must be signed in to change notification settings - Fork 1
Test OIDC publish path with 2.0.1-rc.1 #10
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 |
|---|---|---|
|
|
@@ -8,9 +8,11 @@ on: | |
| tag: | ||
| # `npm publish --tag X` only works for a *new* version. To re-tag an | ||
| # already-published version, use `npm dist-tag add` outside this workflow. | ||
| description: "Dist-tag for the new version being published (e.g. next, beta). Does not retag existing versions." | ||
| # Leave blank to auto-detect: semver prereleases (anything with a `-` | ||
| # in the version) publish under `next`, stable versions under `latest`. | ||
|
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. [Major] dist-tag override에 대한 설명이 부족합니다. 사용자가 dist-tag를 명시적으로 지정할 수 있도록 설명해야 합니다. |
||
| description: "Dist-tag override (leave blank for auto: prerelease→next, stable→latest)" | ||
| required: false | ||
| default: "latest" | ||
| default: "" | ||
|
|
||
| jobs: | ||
| publish: | ||
|
|
@@ -33,11 +35,25 @@ jobs: | |
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| # Node 22 ships npm 11; npm Trusted Publishers (OIDC) requires | ||
| # npm 11.5.1+ to perform the OIDC token exchange. | ||
| node-version: "22" | ||
| # Node 24 LTS ships npm 11.x; npm Trusted Publishers (OIDC) needs | ||
| # npm 11.5.1+ to perform the token exchange. Node 22's older | ||
| # patch releases shipped npm 10.x, so picking 24 sidesteps the | ||
| # need to upgrade npm out-of-band. | ||
| node-version: "24" | ||
| registry-url: "https://registry.npmjs.org" | ||
|
|
||
| - name: Verify npm version supports OIDC trusted publishers | ||
| # Belt-and-suspenders against actions/setup-node ever resolving an | ||
| # older Node 24 patch with a too-old bundled npm. | ||
| run: | | ||
| NPM_VERSION=$(npm --version) | ||
| REQUIRED="11.5.1" | ||
| if [ "$(printf '%s\n%s\n' "$REQUIRED" "$NPM_VERSION" | sort -V | head -n1)" != "$REQUIRED" ]; then | ||
| echo "::error::npm $NPM_VERSION installed; OIDC trusted publishers require >= $REQUIRED" | ||
| exit 1 | ||
| fi | ||
| echo "npm $NPM_VERSION ≥ $REQUIRED ✓" | ||
|
|
||
| - name: Verify release commit is on main | ||
| if: github.event_name == 'release' | ||
| # Catches releases accidentally cut from a feature branch or stale commit. | ||
|
|
@@ -75,6 +91,26 @@ jobs: | |
| # Catch ESM/CJS or path-resolution regressions before publishing. | ||
| run: npm run smoke | ||
|
|
||
| - name: Resolve npm dist-tag | ||
| id: dist_tag | ||
| # A semver prerelease (2.0.1-rc.1) accidentally going out under the | ||
| # `latest` tag would displace the stable release for every consumer | ||
| # doing `npm install <pkg>`. Auto-route prereleases to `next`; allow | ||
| # an explicit override via workflow_dispatch. | ||
| env: | ||
| INPUT_TAG: ${{ inputs.tag }} | ||
| run: | | ||
| PKG_VERSION=$(node -p "require('./package.json').version") | ||
| if [ -n "$INPUT_TAG" ]; then | ||
| DIST_TAG="$INPUT_TAG" | ||
| elif [[ "$PKG_VERSION" == *-* ]]; then | ||
|
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. [Suggestion] Bash의 |
||
| DIST_TAG="next" | ||
| else | ||
| DIST_TAG="latest" | ||
| fi | ||
| echo "Publishing $PKG_VERSION under dist-tag: $DIST_TAG" | ||
| echo "tag=$DIST_TAG" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Publish to npm | ||
| # Authentication is handled by npm Trusted Publishers (OIDC) — the | ||
| # `id-token: write` permission above plus the registry-url from | ||
|
|
@@ -83,6 +119,4 @@ jobs: | |
| # required; nothing to rotate every 90 days. | ||
| # `provenance: true` lives in package.json's publishConfig, so it | ||
| # applies regardless of who runs `npm publish`. | ||
| run: npm publish --tag "${TAG:-latest}" | ||
| env: | ||
| TAG: ${{ inputs.tag }} | ||
| run: npm publish --tag "${{ steps.dist_tag.outputs.tag }}" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "@swift-man/material-design-color", | ||
| "version": "2.0.0", | ||
| "version": "2.0.1-rc.1", | ||
|
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. [Major] PR 본문에서 'rc' 태그 배포를 의도하셨으나, 기존처럼 GitHub Release 이벤트를 통해 이 버전을 배포하게 되면 워크플로우의 |
||
| "type": "module", | ||
| "description": "Material Design 3 color schemes (light/dark, 48 roles) and Material 2 palette for TypeScript / JavaScript. Framework-agnostic — works in React Native, Expo, web, Node.", | ||
| "license": "MIT", | ||
|
|
||
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.
[Major] dist-tag 설정이 자동으로 결정되도록 수정되었습니다. RC 버전이 배포될 경우 stable 버전이 아닌 next 버전으로 배포될 수 있습니다.