From 577cfd08e865611798c6fb5b86c720519b2242a1 Mon Sep 17 00:00:00 2001 From: Archicratia Date: Thu, 26 Feb 2026 12:40:47 +0100 Subject: [PATCH] ci: deploy staging+live (annotations) with manual force --- .gitea/workflows/deploy-staging-live.yml | 34 +++++++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/deploy-staging-live.yml b/.gitea/workflows/deploy-staging-live.yml index 5c6e200..bed9635 100644 --- a/.gitea/workflows/deploy-staging-live.yml +++ b/.gitea/workflows/deploy-staging-live.yml @@ -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 }} -- 2.49.1