ci: harden test tag guards
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:
@@ -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 }}" \
|
||||
|
||||
Reference in New Issue
Block a user