From f6f2ca9a29557e75a0a6060ec05ccb06e69f132e Mon Sep 17 00:00:00 2001 From: shanshanzhong147 Date: Wed, 3 Jun 2026 06:48:41 -0700 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E6=A1=A3+=E9=85=8D=E7=BD=AE:=20workfl?= =?UTF-8?q?ow=20=E5=85=A8=E9=9D=A2=E6=B1=89=E5=8C=96=20+=20actions=20?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=E5=88=B0=20Node=2024=20+=20=E5=85=B3?= =?UTF-8?q?=E9=97=AD=20docker=20=E8=8B=B1=E6=96=87=20summary=20(#6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit owner 反馈 GitHub Actions UI 上 'Build image and deploy to staging' 等英文 job 名、'Docker Build summary / Build inputs / Build records include...' 等英文 summary 文本不符合中文开发者团队约定。 ## 汉化(全部显示字段) - ci.yml: workflow name '持续集成'、job '构建/Vet/测试' 和 'golangci-lint'、 所有 step name 中文(保留 golangci-lint / Go 等工具名) - deploy-staging.yml: workflow name '测试环境部署'、job '构建镜像并部署到 测试环境'、11 个 step name 中文 - doc/development-workflow-zh.md: 同步 4 处对 'Deploy Staging' 显示名的 引用,改为 '测试环境部署 (deploy-staging.yml)' 形式,以文件名锚定 ## 关闭 docker/build-push-action 英文 summary deploy-staging.yml workflow env 加 DOCKER_BUILD_SUMMARY=false。原来跑完 build 那个英文 'Docker Build summary / Build inputs / ...' 块在 GitHub Actions UI 上不再出现。部署结果靠 Telegram 通知传递。 ## actions 升级到支持 Node 24 的版本 GitHub Runner 报 Node 20 deprecated 警告,9 月 16 日强制移除。本次一次 性升级到当前 latest: - actions/checkout v4 -> v6 - actions/setup-go v5 -> v6 - docker/setup-buildx-action v3 -> v4 - docker/build-push-action v6 -> v7 - appleboy/scp-action v0.1.7 -> v1.0.0 (正式版) - appleboy/ssh-action v1.0.3 -> v1.2.5 - golangci/golangci-lint-action v6 -> v9 (Node 24,仍支持 version: latest 和 only-new-issues: true) 不改: - workflow .yml 文件名(gh CLI / 文档引用都用文件名锚定,不动) - secret 名 / env var 名(约定俗成全大写英文) - Telegram 通知正文(本来就是中文) ## 后续 agent prompt(架构师/QA/devops)里引用 'Build, vet, test' / 'Deploy Staging' 显示名的部分,PR merge 后另外 multica agent update 同步。 不在本 PR 范围。 --- .github/workflows/ci.yml | 30 ++++++++++----------- .github/workflows/deploy-staging.yml | 39 +++++++++++++++------------- doc/development-workflow-zh.md | 8 +++--- 3 files changed, 40 insertions(+), 37 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b95b70..2661f29 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: CI +name: 持续集成 on: pull_request: @@ -16,30 +16,30 @@ concurrency: jobs: build-and-test: - name: Build, vet, test + name: 构建/Vet/测试 runs-on: ubuntu-latest timeout-minutes: 20 steps: - - name: Checkout - uses: actions/checkout@v4 + - name: 检出代码 + uses: actions/checkout@v6 - - name: Setup Go - uses: actions/setup-go@v5 + - name: 配置 Go 环境 + uses: actions/setup-go@v6 with: go-version-file: go.mod cache: true - - name: Download modules + - name: 下载依赖模块 run: go mod download - - name: Build + - name: 构建 run: go build ./... - - name: Vet + - name: 运行 go vet run: go vet ./... - - name: Test + - name: 运行测试 run: go test -race -count=1 ./... lint: @@ -48,20 +48,20 @@ jobs: timeout-minutes: 10 steps: - - name: Checkout - uses: actions/checkout@v4 + - name: 检出代码 + uses: actions/checkout@v6 with: # Fetch base ref so golangci-lint can diff against it for only-new-issues. fetch-depth: 0 - - name: Setup Go - uses: actions/setup-go@v5 + - name: 配置 Go 环境 + uses: actions/setup-go@v6 with: go-version-file: go.mod cache: true - name: golangci-lint - uses: golangci/golangci-lint-action@v6 + uses: golangci/golangci-lint-action@v9 with: version: latest args: --timeout=5m diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index ffb490f..29918b8 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -1,4 +1,4 @@ -name: Deploy Staging +name: 测试环境部署 on: push: @@ -20,20 +20,23 @@ env: STAGING_HOST: ${{ vars.STAGING_HOST || '154.12.35.103' }} STAGING_DEPLOY_PATH: ${{ vars.STAGING_DEPLOY_PATH || '/opt/hifast-server' }} STAGING_HEALTHCHECK_URL: ${{ vars.STAGING_HEALTHCHECK_URL || 'http://127.0.0.1:8080/v1/common/heartbeat' }} + # 关闭 docker/build-push-action 自动生成的英文 job summary + # 我们用 Telegram 通知传递部署结果,不需要 GitHub Actions 页面上那段英文 + DOCKER_BUILD_SUMMARY: false jobs: build-and-deploy: - name: Build image and deploy to staging + name: 构建镜像并部署到测试环境 runs-on: ubuntu-latest timeout-minutes: 30 steps: - - name: Checkout - uses: actions/checkout@v4 + - name: 检出代码 + uses: actions/checkout@v6 with: fetch-depth: 0 - - name: Collect release notes + - name: 收集发布说明 id: release-notes run: | set -euo pipefail @@ -55,20 +58,20 @@ jobs: echo "EOF" } >> "$GITHUB_OUTPUT" - - name: Setup Go - uses: actions/setup-go@v5 + - name: 配置 Go 环境 + uses: actions/setup-go@v6 with: go-version-file: go.mod cache: true - - name: Test + - name: 运行测试 run: go test ./... - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + - name: 配置 Docker Buildx + uses: docker/setup-buildx-action@v4 - - name: Build and push image - uses: docker/build-push-action@v6 + - name: 构建并推送镜像 + uses: docker/build-push-action@v7 with: context: . file: ./Dockerfile @@ -81,8 +84,8 @@ jobs: ${{ env.IMAGE_NAME }}:${{ github.sha }} ${{ env.IMAGE_NAME }}:staging - - name: Copy compose file - uses: appleboy/scp-action@v0.1.7 + - name: 上传 compose 配置 + uses: appleboy/scp-action@v1.0.0 with: host: ${{ env.STAGING_HOST }} username: ${{ secrets.STAGING_SSH_USER }} @@ -91,8 +94,8 @@ jobs: source: docker-compose.cloud.yml target: /tmp/hifast-server-deploy/ - - name: Deploy on staging server - uses: appleboy/ssh-action@v1.0.3 + - name: 在测试服务器上部署 + uses: appleboy/ssh-action@v1.2.5 with: host: ${{ env.STAGING_HOST }} username: ${{ secrets.STAGING_SSH_USER }} @@ -193,7 +196,7 @@ jobs: docker_cmd image prune -f || true exit 1 - - name: Notify Telegram on success + - name: Telegram 成功通知 if: success() env: TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} @@ -221,7 +224,7 @@ jobs: --data-urlencode "chat_id=${TG_CHAT_ID}" \ --data-urlencode "text=${MESSAGE}" || echo "Telegram 通知发送失败,但发布结果不受影响。" - - name: Notify Telegram on failure + - name: Telegram 失败通知 if: failure() env: TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} diff --git a/doc/development-workflow-zh.md b/doc/development-workflow-zh.md index 1991ead..445f280 100644 --- a/doc/development-workflow-zh.md +++ b/doc/development-workflow-zh.md @@ -9,7 +9,7 @@ ``` Multica issue → 分支 fix/-中文简述 → 推 github → 开 PR → CI 绿 → 架构师 approve - → GitHub UI Squash and merge 进 internal → Deploy Staging 自动跑 + → GitHub UI Squash and merge 进 internal → 测试环境部署 (deploy-staging.yml) 自动跑 → QA 在 staging 验收 → Multica issue → done 发版时:架构师把 internal squash 进 main → 对外正式版本 @@ -111,7 +111,7 @@ gh pr create --base internal --title '修复(#): ...' --body-file - **必须用 GitHub UI 的 "Squash and merge"**。 - squash 后 commit message 由架构师编辑确认:保持 `<类型>(#): ...` 形式 + 必要正文。 - 合并按钮按下后 PR 自动 close,分支由 GitHub 自动删("Automatically delete head branches" 应开启)。 -- 架构师在 Multica issue 上 `@运维工程师` 附 commit hash,通知可以部署(虽然 Deploy Staging 已自动跑,但运维需要确认部署状态)。 +- 架构师在 Multica issue 上 `@运维工程师` 附 commit hash,通知可以部署(虽然测试环境部署 workflow 已自动跑,但运维需要确认部署状态)。 **禁止做的事**: - ❌ 在本地 squash 再 `git push` 到 `internal` / `main` @@ -121,7 +121,7 @@ gh pr create --base internal --title '修复(#): ...' --body-file - ❌ 自己 approve 自己的 PR - ❌ 未经测试工程师验收的分支合并(架构师红线) -### 2.7 Deploy Staging 自动触发 +### 2.7 测试环境部署自动触发 (`.github/workflows/deploy-staging.yml`) 合并到 `internal` 后,`.github/workflows/deploy-staging.yml` 自动触发: @@ -159,7 +159,7 @@ gh pr create --base main --head internal --title '发版: <版本号>' | `todo` | 已排期,待 assigned agent 开始 | | `in_progress` | 分支已开始写,未 push | | `in_review` | PR 已开,等 review / CI / merge | -| `done` | PR merged + Deploy Staging 通过 + QA 验收通过 | +| `done` | PR merged + 测试环境部署通过 + QA 验收通过 | **三个条件没全满足就不要标 done**——否则验收链路看不到真问题。