feat(gitea): switch to fast deploy track with nightly github validation
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
name: Gitea CI/CD Pipeline
|
||||
name: Gitea Fast Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, master, develop]
|
||||
pull_request:
|
||||
branches: [main, master, develop]
|
||||
|
||||
concurrency:
|
||||
group: ci-${{ github.workflow }}-${{ github.ref }}
|
||||
@@ -18,6 +16,7 @@ env:
|
||||
jobs:
|
||||
test:
|
||||
name: Test Backend
|
||||
if: github.event_name == 'pull_request'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
|
||||
@@ -96,8 +95,7 @@ jobs:
|
||||
build-and-push:
|
||||
name: Build and Push Image
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop'
|
||||
timeout-minutes: 30
|
||||
outputs:
|
||||
image_alias: ${{ steps.meta.outputs.image_alias }}
|
||||
@@ -400,9 +398,9 @@ jobs:
|
||||
echo "Created PR: ${PR_URL}"
|
||||
|
||||
summary:
|
||||
name: CI/CD Summary
|
||||
name: Fast Deploy Summary
|
||||
runs-on: ubuntu-latest
|
||||
needs: [test, build-and-push, update-deploy]
|
||||
needs: [build-and-push, update-deploy]
|
||||
if: always()
|
||||
steps:
|
||||
- name: Generate summary
|
||||
@@ -412,9 +410,8 @@ jobs:
|
||||
SUMMARY_FILE="${GITHUB_STEP_SUMMARY:-/tmp/gitea-step-summary.md}"
|
||||
|
||||
{
|
||||
echo "## Gitea CI/CD Pipeline Summary"
|
||||
echo "## Gitea Fast Deploy Summary"
|
||||
echo
|
||||
echo "- Test: ${{ needs.test.result }}"
|
||||
echo "- Build: ${{ needs.build-and-push.result }}"
|
||||
echo "- Deploy: ${{ needs.update-deploy.result }}"
|
||||
if [ "${{ needs.build-and-push.result }}" = "success" ]; then
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# 部署双轨约定(Gitea 快速部署 + GitHub 夜间全量验证)
|
||||
|
||||
## 目标
|
||||
|
||||
- 白天快速发布:走 Gitea workflow,尽快完成镜像与部署仓库更新。
|
||||
- 夜间完整验证:走 GitHub workflow + 端到端验收脚本,验证全链路稳定性。
|
||||
|
||||
## 日间快速部署(Gitea)
|
||||
|
||||
1. 提交代码到本地仓库。
|
||||
2. 推送到 Gitea 仓库(触发 `.gitea/workflows/ci.yml`):
|
||||
|
||||
```bash
|
||||
./scripts/gitea-fast-deploy.sh
|
||||
```
|
||||
|
||||
默认 remote 为 `gitea`,对应:
|
||||
|
||||
- `http://192.168.1.83:33000/gao/ljwx-shiti.git`
|
||||
- deploy repo: `http://192.168.1.83:33000/gao/ljwx-deploy.git`
|
||||
|
||||
说明:
|
||||
|
||||
- 当前 `.gitea/workflows/ci.yml` 已切为 Fast Deploy 模式:以构建+部署为主,不执行完整测试链路。
|
||||
|
||||
## 夜间完整验证(GitHub)
|
||||
|
||||
每天凌晨 3 点由 cron 执行:
|
||||
|
||||
- 触发 `build-and-notify.yml`(GitHub)
|
||||
- 等待 workflow 完成
|
||||
- 执行 `scripts/verify-e2e-deploy.sh --require-sync-logs`
|
||||
- 产出报告 `/tmp/ljwx-shiti-e2e-nightly-<timestamp>.md`
|
||||
|
||||
执行脚本:
|
||||
|
||||
- `scripts/nightly-e2e.sh`
|
||||
|
||||
日志文件:
|
||||
|
||||
- `scripts/nightly-e2e.log`
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
REMOTE="${REMOTE:-gitea}"
|
||||
BRANCH="${BRANCH:-$(git rev-parse --abbrev-ref HEAD)}"
|
||||
|
||||
if ! git remote get-url "${REMOTE}" >/dev/null 2>&1; then
|
||||
echo "[error] git remote not found: ${REMOTE}" >&2
|
||||
echo "[hint] add it first, e.g. git remote add gitea http://192.168.1.83:33000/gao/ljwx-shiti.git" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${BRANCH}" == "HEAD" ]]; then
|
||||
echo "[error] detached HEAD is not supported" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[info] push ${BRANCH} to ${REMOTE} (fast deploy)"
|
||||
git push "${REMOTE}" "${BRANCH}"
|
||||
echo "[done] gitea workflow should be triggered"
|
||||
Reference in New Issue
Block a user