@dinoxx/dinox-cli 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +32 -0
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -520,3 +520,35 @@ dino <命令> <子命令> --help
520
520
  dino note --help
521
521
  dino note create --help
522
522
  ```
523
+
524
+ ---
525
+
526
+ ## 10. GitHub Action 自动发布 npm
527
+
528
+ 仓库已内置工作流:`/Users/shanks/Documents/GitHub/dinox-cli/.github/workflows/publish-npm.yml`
529
+
530
+ ### 10.1 先配置 Secret
531
+
532
+ 在 GitHub 仓库设置里添加:
533
+
534
+ - `NPM_TOKEN`:npm 的 publish token(建议使用 granular token,并开启 bypass 2FA)
535
+
536
+ ### 10.2 手动触发发布
537
+
538
+ 1. 打开 GitHub 仓库 → **Actions** → **Publish NPM**
539
+ 2. 点击 **Run workflow**
540
+ 3. 选择参数:
541
+ - `dry_run`:`true` 只做演练,不真正发布
542
+ - `run_tests`:`true` 时会先执行测试
543
+
544
+ ### 10.3 Push 自动触发
545
+
546
+ - 每次 push 到默认分支(当前为 `main`)会自动触发发布流程
547
+ - 为兼容分支命名迁移,workflow 也监听 `master`,但发布阶段会只允许默认分支执行
548
+ - 为防止递归触发,workflow 会跳过 `github-actions[bot]` 自己提交的版本 bump commit
549
+
550
+ ### 10.4 工作流行为
551
+
552
+ - 只允许在仓库默认分支执行发布(默认分支改名后无需改 workflow 逻辑)
553
+ - 调用仓库脚本 `publish-npm.sh` 自动递增 patch 版本并发布
554
+ - 发布成功后自动提交 `package.json` 版本变更、打 `vX.Y.Z` tag 并 push 回仓库
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@dinoxx/dinox-cli",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Dinox CLI",
5
5
  "main": "dist/dinox.js",
6
6
  "scripts": {
7
7
  "build": "tsc -p tsconfig.json && node scripts/add-shebang.mjs",
8
8
  "dev": "tsx src/dinox.ts",
9
9
  "prepublishOnly": "npm run build",
10
- "publish:npm": "sh scripts/publish-npm.sh",
11
- "publish:npm:dry-run": "sh scripts/publish-npm.sh --dry-run",
10
+ "publish:npm": "sh ./publish-npm.sh",
11
+ "publish:npm:dry-run": "sh ./publish-npm.sh --dry-run",
12
12
  "start": "node dist/dinox.js",
13
- "test": "node --test --import tsx test/**/*.test.ts"
13
+ "test": "node --test --import tsx test/*.test.ts"
14
14
  },
15
15
  "keywords": [],
16
16
  "author": "",