ci: deploy staging+live (annotations) with manual force
All checks were successful
CI / build-and-anchors (push) Successful in 1m51s
SMOKE / smoke (push) Successful in 15s

This commit is contained in:
2026-02-26 12:40:47 +01:00
parent 5e95dc9898
commit 577cfd08e8

View File

@@ -4,6 +4,11 @@ on:
push:
branches: [main]
workflow_dispatch:
inputs:
force:
description: "Force deploy even if gate would skip (1=yes, 0=no)"
required: false
default: "0"
env:
NODE_OPTIONS: --dns-result-order=ipv4first
@@ -68,16 +73,26 @@ jobs:
echo "REPO_URL=$REPO_URL" >> /tmp/deploy.env
- name: Gate — auto deploy only on annotations/media changes
env:
INPUT_FORCE: ${{ inputs.force }}
run: |
set -euo pipefail
source /tmp/deploy.env
# fichiers touchés par CE commit (merge commit inclus)
CHANGED="$(git diff-tree --no-commit-id --name-only -r "$SHA" || true)"
source /tmp/deploy.env 2>/dev/null || true
FORCE="${INPUT_FORCE:-0}"
if [[ "$FORCE" == "1" ]]; then
echo "✅ force=1 -> bypass gate -> deploy allowed"
echo "GO=1" >> /tmp/deploy.env
exit 0
fi
# fichiers touchés par CE commit (⚠️ merge commits -> utiliser -m)
CHANGED="$(git diff-tree -m --no-commit-id --name-only -r "$SHA" || true)"
echo "== changed files =="
echo "$CHANGED" | sed -n '1,200p'
# Gate strict : uniquement annotations + media + le workflow lui-même (si tu veux autoriser)
# Gate strict : uniquement annotations + media
if echo "$CHANGED" | grep -qE '^(src/annotations/|public/media/)'; then
echo "GO=1" >> /tmp/deploy.env
echo "✅ deploy allowed (annotations/media change detected)"
@@ -122,6 +137,17 @@ jobs:
test -n "${PUBLIC_GITEA_REPO:-}" || { echo "❌ missing repo var PUBLIC_GITEA_REPO"; exit 2; }
echo "✅ vars OK"
- name: Assert deploy files exist
run: |
set -euo pipefail
source /tmp/deploy.env
[[ "${GO:-0}" == "1" ]] || { echo " skipped"; exit 0; }
test -f docker-compose.yml
test -f Dockerfile
test -f nginx.conf
echo "✅ deploy files OK"
- name: Build + deploy staging (blue) then smoke
env:
PUBLIC_GITEA_BASE: ${{ vars.PUBLIC_GITEA_BASE }}