Skip to content

Commit ff6b471

Browse files
author
iammm0
committed
docs(release): 说明 NPM_TOKEN 在 2FA 下须绕过发布 OTP
Made-with: Cursor
1 parent 1295cb0 commit ff6b471

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# 自动发布 npm 包 @opensec/secbot(以 2.0.0 / 标签 v2.0.0 为例)
22
# 1. 确认根目录 package.json 的 version 与即将打的标签一致(如 2.0.0 对应标签 v2.0.0)。
3-
# 2. 在仓库 Settings → Secrets and variables → Actions 中配置 NPM_TOKEN:
4-
# 推荐使用 Granular Access Token(Packages: Read and write,权限范围含 @opensec),
5-
# 或 Classic 的「Automation」令牌(需启用 2FA 时仍可不交互发布)。
6-
# 账号 iammm0 须在 npm 组织 opensec 中有权发布 @opensec/*(403 多为令牌无权或缺 --access public)。
3+
# 2. NPM_TOKEN(npm 账号若开启 2FA,必须二选一,否则会报 403:需 bypass 2FA 才能 publish):
4+
# · Granular Access Token:Packages 选 Read and write;创建时勾选「允许发布时绕过双因素认证」
5+
# (英文界面类似 "Bypass two-factor authentication (2FA) for writes",以 npm 网站为准)。
6+
# · 或 Classic Token:类型必须选 Automation(勿用需 OTP 的 Publish 类令牌)。
7+
# 权限须覆盖 @opensec;GitHub Secret 名仍为 NPM_TOKEN。
78
# 3. git tag v2.0.0 && git push origin v2.0.0
89
# 将触发:构建 → 校验版本 → 打 GitHub Release 并上传 tgz → npm publish。
910

docs/RELEASE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ GitHub Actions 工作流:
5050
3. 打包发布产物并上传到 GitHub Release。
5151
4. 发布 npm 包(如配置)。
5252

53+
**`NPM_TOKEN` 与 2FA**:若 npm 账号启用了双因素认证,CI 里必须用 **Granular 令牌且允许发布时绕过 2FA**,或 **Classic 的 Automation 令牌**;否则会出现 `403 ... bypass 2fa enabled is required to publish`
54+
5355
## 本地发布任务
5456

5557
安装依赖:

0 commit comments

Comments
 (0)