Skip to content

Commit b4360ff

Browse files
committed
fix release yml
1 parent e2e6f9c commit b4360ff

File tree

10 files changed

+54
-18
lines changed

10 files changed

+54
-18
lines changed

.github/workflows/release.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,26 @@ jobs:
4242
- name: Install dependencies
4343
run: bun install --frozen-lockfile
4444

45+
- name: Debug release target and auth mode
46+
env:
47+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
48+
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
49+
run: |
50+
echo "package_name=$(node -p "require('./packages/core/package.json').name")"
51+
echo "package_version=$(node -p "require('./packages/core/package.json').version")"
52+
echo "registry=$(npm config get registry)"
53+
if [ -n "${ACTIONS_ID_TOKEN_REQUEST_TOKEN:-}" ] && [ -n "${ACTIONS_ID_TOKEN_REQUEST_URL:-}" ]; then
54+
echo "oidc=available"
55+
else
56+
echo "oidc=unavailable"
57+
fi
58+
if [ -n "${NPM_TOKEN:-}" ]; then
59+
echo "npm_token=present"
60+
npm whoami || true
61+
else
62+
echo "npm_token=missing"
63+
fi
64+
4565
- name: Run lint
4666
run: bun run lint
4767

README.ko.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ bun run release:dry-run
3434
## 패키지 사용 예시
3535

3636
```ts
37-
import { createDeadClickDetector } from "@clickvoidx/core";
37+
import { createDeadClickDetector } from "@hyunrim03/core";
3838

3939
const detector = createDeadClickDetector({
4040
onDeadClick(report) {

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ bun run release:dry-run
3434
## Package usage
3535

3636
```ts
37-
import { createDeadClickDetector } from "@clickvoidx/core";
37+
import { createDeadClickDetector } from "@hyunrim03/core";
3838

3939
const detector = createDeadClickDetector({
4040
onDeadClick(report) {

bun.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/release-process.en.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ The release workflow maps `secrets.NPM_TOKEN` to both `NPM_TOKEN` and `NPM_CONFI
5050
- Use Node.js `22.14.0+` and npm `11.5.1+` in the release job
5151
- When no npm token is present, the release script falls back to `npm publish --provenance`
5252

53+
The repository now prefers OIDC on GitHub Actions even if `NPM_TOKEN` is also present.
54+
Set `FORCE_NPM_TOKEN_PUBLISH=1` only if you intentionally want to override that behavior.
55+
5356
This avoids the 2FA-token problem entirely.
5457

5558
## Recommended repository settings

docs/release-process.ko.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151
- release job에서 Node.js `22.14.0+`, npm `11.5.1+` 사용
5252
- npm 토큰이 없을 때 release script가 `npm publish --provenance`로 자동 fallback
5353

54+
이 저장소는 이제 GitHub Actions에서 `NPM_TOKEN`이 함께 있어도 OIDC를 우선 사용합니다.
55+
의도적으로 토큰 경로를 강제하고 싶을 때만 `FORCE_NPM_TOKEN_PUBLISH=1`을 사용하면 됩니다.
56+
5457
이 방식은 2FA 토큰 문제를 피할 수 있습니다.
5558

5659
## 권장 GitHub 저장소 설정

packages/core/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# @clickvoidx/core
1+
# @hyunrim03/core
22

33
## 0.1.1
44

packages/core/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# @clickvoidx/core
1+
# @hyunrim03/core
22

33
A Bun-friendly TypeScript package for detecting dead clicks in browser applications.
44

@@ -12,7 +12,7 @@ A Bun-friendly TypeScript package for detecting dead clicks in browser applicati
1212
## Quick example
1313

1414
```ts
15-
import { createDeadClickDetector } from "@clickvoidx/core";
15+
import { createDeadClickDetector } from "@hyunrim03/core";
1616

1717
const detector = createDeadClickDetector({
1818
onDeadClick(report) {

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@clickvoidx/core",
2+
"name": "@hyunrim03/core",
33
"version": "0.1.1",
44
"description": "Dead-click detection core package for browser applications.",
55
"type": "module",

scripts/release-publish.mjs

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import process from "node:process";
66
/**
77
* Release publishing entrypoint.
88
*
9-
* - If an npm token is present, we keep the Bun-based publish path.
10-
* - If no npm token is present but GitHub OIDC variables exist, we fall back to
11-
* npm trusted publishing.
9+
* - On GitHub Actions, OIDC trusted publishing is preferred whenever available.
10+
* - If OIDC is unavailable but an npm token is present, we keep the Bun-based
11+
* publish path.
1212
* - In dry-run mode we only pack the package, so local validation never needs auth.
1313
*/
1414
const isDryRun = process.argv.includes("--dry-run");
@@ -25,6 +25,7 @@ const hasNpmToken = Boolean(npmToken);
2525
const hasOidc = Boolean(
2626
env.ACTIONS_ID_TOKEN_REQUEST_TOKEN && env.ACTIONS_ID_TOKEN_REQUEST_URL
2727
);
28+
const forceTokenPublish = env.FORCE_NPM_TOKEN_PUBLISH === "1";
2829

2930
if (npmToken && !env.NPM_CONFIG_TOKEN) {
3031
env.NPM_CONFIG_TOKEN = npmToken;
@@ -60,19 +61,28 @@ function run(command, args, mode) {
6061
}
6162

6263
if (isDryRun) {
63-
run("bun", ["pm", "pack"], hasNpmToken ? "bun-token" : hasOidc ? "npm-oidc" : "pack-only");
64+
run(
65+
"bun",
66+
["pm", "pack"],
67+
hasOidc && !forceTokenPublish
68+
? "npm-oidc"
69+
: hasNpmToken
70+
? "bun-token"
71+
: "pack-only"
72+
);
6473
}
6574

66-
if (hasNpmToken) {
67-
run("bun", ["publish", "--access", "public", "--tolerate-republish"], "bun-token");
75+
if (hasOidc && !forceTokenPublish) {
76+
run("npm", ["publish", "--access", "public", "--provenance"], "npm-oidc");
6877
}
6978

70-
if (hasOidc) {
71-
run("npm", ["publish", "--access", "public", "--provenance"], "npm-oidc");
79+
if (hasNpmToken) {
80+
run("bun", ["publish", "--access", "public", "--tolerate-republish"], "bun-token");
7281
}
7382

7483
console.error(
7584
"[release] Missing publish credentials. Provide NPM_TOKEN/NPM_CONFIG_TOKEN " +
76-
"or configure npm trusted publishing with GitHub OIDC (id-token: write)."
85+
"or configure npm trusted publishing with GitHub OIDC (id-token: write). " +
86+
"GitHub Actions prefers OIDC unless FORCE_NPM_TOKEN_PUBLISH=1 is set."
7787
);
7888
process.exit(1);

0 commit comments

Comments
 (0)