Compare commits

...

1 Commits

Author SHA1 Message Date
xiaoxia c678ca387b ci: 优化镜像 tag 策略 - develop 用 dev 固定 tag 覆盖推送,feature 分支跳过部署
CI/CD Pipeline / Frontend Lint (push) Successful in 1m56s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 2m40s
CI/CD Pipeline / Validate Code Quality And Tests (push) Failing after 10m1s
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (push) Has been skipped
CI/CD Pipeline / Build Production Runtime Images (push) Has been skipped
CI/CD Pipeline / Staging E2E Tests (push) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (push) Has been skipped
CI/CD Pipeline / Deploy Production (push) Has been skipped
CI/CD Pipeline / Production Browser E2E (push) Has been skipped
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 10m2s
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Build Production Runtime Images (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
2026-07-09 13:33:30 +08:00
+17 -3
View File
@@ -376,7 +376,7 @@ jobs:
timeout-minutes: 30
needs: [validate, frontend-lint]
if: github.ref_name == 'main' || github.ref_name == 'develop' || startsWith(github.ref_name, 'feature/')
if: github.ref_name == 'main' || github.ref_name == 'develop'
steps:
- name: Checkout code
@@ -424,6 +424,20 @@ jobs:
tar.extract(member, '.')
INNERPY
- name: Determine image tag based on branch
shell: sh
run: |
set -eu
if [ "${GITHUB_REF_NAME}" = "develop" ]; then
# develop 分支:固定 dev tag,覆盖推送,不累积版本
echo "IMAGE_TAG=dev" >> "$GITHUB_ENV"
echo "Mode: develop → :dev tag (overwrite, no accumulation)"
else
# main 分支:用 commit SHA 作为 tag
echo "IMAGE_TAG=${GITHUB_SHA}" >> "$GITHUB_ENV"
echo "Mode: ${GITHUB_REF_NAME} → :${GITHUB_SHA} tag"
fi
- name: Build and push all images to Gitea Registry
shell: sh
env:
@@ -432,7 +446,7 @@ jobs:
set -eu
chmod +x scripts/build_release_images.sh
ALLOW_SHARED_PRODUCTION_BUILD_HOST=true REGISTRY_TOKEN="${REGISTRY_TOKEN}" \
scripts/build_release_images.sh "${GITHUB_SHA}" staging
scripts/build_release_images.sh "${IMAGE_TAG}" staging
- name: Tag and push :staging images (Watchtower auto-update)
shell: sh
@@ -445,7 +459,7 @@ jobs:
printf '%s' "${REGISTRY_TOKEN}" | docker login git.xiaoxiajianji.com -u xiaoxia --password-stdin 2>/dev/null
fi
for svc in api worker web; do
docker tag "${REGISTRY}/xiaoxia-saas-${svc}:${GITHUB_SHA}" "${REGISTRY}/xiaoxia-saas-${svc}:staging"
docker tag "${REGISTRY}/xiaoxia-saas-${svc}:${IMAGE_TAG}" "${REGISTRY}/xiaoxia-saas-${svc}:staging"
docker push "${REGISTRY}/xiaoxia-saas-${svc}:staging"
done
echo "All :staging images pushed. Watchtower will auto-deploy within 60s."