ci: harden test tag guards
Build Push and Deploy / docker-image (push) Failing after 51s
Build Push and Deploy / deploy-fallback-log (push) Successful in 0s

Use direct shell checks on github.ref_name inside workflow steps so test tags skip registry login, image push, and deploy webhook regardless of Gitea expression behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-04-24 16:01:08 +08:00
parent 3ba252462d
commit 46a4d7157d
2 changed files with 22 additions and 6 deletions
+20 -6
View File
@@ -75,8 +75,14 @@ jobs:
} >> "$GITHUB_ENV"
- name: Login to Gitea Container Registry
if: ${{ !endsWith(github.ref_name, '-test') }}
run: |
case "${{ github.ref_name }}" in
*-test)
echo "Test tag detected; skipping registry login."
exit 0
;;
esac
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login "$REGISTRY_HOST" \
--username "${{ secrets.REGISTRY_USERNAME }}" \
--password-stdin
@@ -97,16 +103,24 @@ jobs:
--build-arg NEXT_PUBLIC_MAPBOX_TOKEN="${{ secrets.NEXT_PUBLIC_MAPBOX_TOKEN }}" \
--build-arg NEXT_PUBLIC_TIANDITU_TOKEN="${{ secrets.NEXT_PUBLIC_TIANDITU_TOKEN }}" \
.
if [ "${{ endsWith(github.ref_name, '-test') }}" = "true" ]; then
echo "Test tag detected; build completed without pushing images."
exit 0
fi
case "${{ github.ref_name }}" in
*-test)
echo "Test tag detected; build completed without pushing images."
exit 0
;;
esac
docker push "${IMAGE_NAME}:${IMAGE_TAG}"
docker push "${IMAGE_NAME}:latest"
- name: Notify Deploy Server
if: ${{ success() && !endsWith(github.ref_name, '-test') }}
run: |
case "${{ github.ref_name }}" in
*-test)
echo "Test tag detected; skipping deploy webhook."
exit 0
;;
esac
curl -fsSL -X POST "${{ vars.DEPLOY_WEBHOOK_URL }}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${{ secrets.DEPLOY_WEBHOOK_TOKEN }}" \