ci: 打 v* tag 自动发版到 ali(Gitea Actions)

新增 Gitea Actions 流水线,复刻本地 deploy.sh 到 CI,打 v* tag 即自动发版:
- .gitea/workflows/deploy.yml:v*.*.* tag 触发 → go test → 交叉编译 linux/amd64
  → 传 ali → 备份 payd.bak → 切换 → systemctl restart pay → 探活(失败自动回滚)
- .gitea/workflows/checks.yml:PR/合并 main 跑 go vet+build+test 静态闸
- scripts/ci/deploy.sh:本地 deploy.sh 的 CI 版(从 secret 注入部署私钥 + 主机,
  不用 ~/.ssh 的 ali 别名);notify.sh:Telegram 通知(secrets 未配则静默跳过)
- runs-on mac,复用 jiu 的自建 runner;业务密钥仍走 ali /etc/pay/pay.env
- README 部署段补 CI 路径 + 所需 secrets(ALI_SSH_KEY/ALI_HOST/ALI_USER)

首次需在 pay 仓 Gitea → Settings → Actions → Secrets 配 3 个 ALI_* secret。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019UQmqWmV67sXGLrb3U1XXn
This commit is contained in:
wangjia
2026-07-05 12:16:36 +08:00
parent e0c7baa7cb
commit b9f89f6526
6 changed files with 183 additions and 2 deletions
+9 -2
View File
@@ -60,9 +60,16 @@ pay/
## 构建部署
**一键发布到 ali(推荐)**
**打 tag 自动发版到 ali(推荐)**Gitea Actions 在 `v*` tag 上跑 `go test` → 交叉编译 → 传 ali → 备份 → 重启 → 探活(失败自动回滚)。
```bash
./deploy.sh # 交叉编译 linux/amd64 → 传 ali → 备份 → 重启 pay → 探活(失败自动回滚)
git tag v1.0.2 && git push origin v1.0.2 # 触发 .gitea/workflows/deploy.yml
```
- runs-on `mac`(复用 jiu 的自建 runner);PR/合并 main 另跑 `checks.yml`vet+build+test)。
- **首次需在 pay 仓 Gitea → Settings → Actions → Secrets 配**`ALI_SSH_KEY`(授权 ali root 的部署私钥整段)、`ALI_HOST`、`ALI_USER`root);可选 `TELEGRAM_TOKEN`/`TELEGRAM_CHAT_ID`(发布通知,不配则跳过)。密钥只进 Gitea Secrets,不入库。
**本地一键发布(等价手动路径)**:
```bash
./deploy.sh # 交叉编译 linux/amd64 → 传 alissh 别名)→ 备份 → 重启 pay → 探活(失败自动回滚)
```
手动构建: