From 88234ac9275728b9397ad8e4643f778c13038158 Mon Sep 17 00:00:00 2001 From: rock Date: Tue, 8 Sep 2026 15:59:16 -0700 Subject: [PATCH] ci: enable docker build & sha extraction on PRs - Get short SHA on all events (PRs + pushes) - Registry login on all events - Build Docker image on all events (validate Dockerfile on PRs) - Push only on push/workflow_dispatch (not PRs) - Prune images on all events This ensures PR builds verify Docker image builds successfully --- .gitea/workflows/build.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 8b03daa..7d32b91 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -36,12 +36,10 @@ jobs: run: cargo clippy --all --all-targets -- -D warnings 2>&1 | tail -50 || true - name: Get short SHA - if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' id: sha run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - name: Registry login - if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' run: | echo "${REGISTRY_TOKEN}" | docker login "${REGISTRY}" \ --username "${REGISTRY_USER}" --password-stdin @@ -50,7 +48,6 @@ jobs: REGISTRY_TOKEN: ${{ secrets.FORGEJO_REGISTRY_TOKEN }} - name: Build Docker image - if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' run: | docker build --no-cache --progress=plain \ -t "${IMAGE}:${{ steps.sha.outputs.short_sha }}" \ @@ -65,5 +62,4 @@ jobs: echo "✓ Pushed: ${IMAGE}:${{ steps.sha.outputs.short_sha }}" - name: Prune unused images - if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' run: docker image prune -a --force 2>&1 | tail -3 || true