From 446a2a089db47700d461c8ead6a2ecd6da83e4fc Mon Sep 17 00:00:00 2001 From: traveler Date: Fri, 16 Jan 2026 21:20:18 -0600 Subject: [PATCH] eploy --- .forgejo/workflows/deploy.yml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/.forgejo/workflows/deploy.yml b/.forgejo/workflows/deploy.yml index eef79d1..6bb5985 100644 --- a/.forgejo/workflows/deploy.yml +++ b/.forgejo/workflows/deploy.yml @@ -39,7 +39,7 @@ jobs: fi if [ -z "$BASE" ]; then - echo "No base commit found; deploying nothing." + echo "No base commit found" echo "swarm_files=" >> "$GITHUB_OUTPUT" echo 'compose_matrix={"include":[]}' >> "$GITHUB_OUTPUT" exit 0 @@ -49,11 +49,15 @@ jobs: echo "Changed files:" echo "$CHANGED" - # Swarm stacks live in: swarm/*.yml|yaml + # -------------------- + # Swarm stacks: swarm/*.yml|yaml + # -------------------- SWARM_FILES="$(echo "$CHANGED" | grep -E '^swarm/.*\.ya?ml$' || true)" echo "swarm_files=$(echo "$SWARM_FILES" | xargs)" >> "$GITHUB_OUTPUT" - # Compose YAMLs live in: services/compose///.yml|yaml + # -------------------- + # Compose files: services/compose///*.yml|yaml + # -------------------- COMPOSE_FILES="$(echo "$CHANGED" | grep -E '^services/compose/[^/]+/[^/]+/.*\.ya?ml$' || true)" JSON='{"include":[' @@ -77,7 +81,7 @@ jobs: container: image: docker:27-cli steps: - - name: Checkout repository (git clone, no node) + - name: Checkout repository shell: sh env: CLONE_URL: ${{ github.server_url }}/${{ github.repository }}.git @@ -96,7 +100,7 @@ jobs: set -e cd repo for f in ${{ needs.detect.outputs.swarm_files }}; do - echo "Validating swarm stack file: $f" + echo "Validating $f" docker stack config -c "$f" >/dev/null done @@ -107,14 +111,14 @@ jobs: cd repo for f in ${{ needs.detect.outputs.swarm_files }}; do STACK="$(basename "$f" | sed 's/\.ya\?ml$//')" - echo "Deploying swarm stack: $STACK from $f" + echo "Deploying stack $STACK" docker stack deploy -c "$f" "$STACK" done deploy_compose: needs: detect + # 🔑 CRITICAL FIX — do NOT run when matrix is empty if: ${{ contains(needs.detect.outputs.compose_matrix, '"include":[{') }} - strategy: fail-fast: false matrix: ${{ fromJSON(needs.detect.outputs.compose_matrix) }} @@ -128,7 +132,7 @@ jobs: set -e apk add --no-cache docker-cli-compose - - name: Checkout repository (git clone, no node) + - name: Checkout repository shell: sh env: CLONE_URL: ${{ github.server_url }}/${{ github.repository }}.git @@ -146,7 +150,6 @@ jobs: run: | set -e cd repo - echo "Validating compose file: ${{ matrix.file }}" docker compose -f "${{ matrix.file }}" config -q - name: Deploy compose file @@ -154,6 +157,5 @@ jobs: run: | set -e cd repo - echo "Deploying compose file: ${{ matrix.file }}" docker compose -f "${{ matrix.file }}" pull - docker compose -f "${{ matrix.file }}" up -d --remove-orphans + docker c