From ba86c3cedb2fdcdcb42825f255a07cfabc4ebf18 Mon Sep 17 00:00:00 2001 From: rock Date: Sun, 6 Sep 2026 23:38:01 -0700 Subject: [PATCH] fix: use env vars for docker registry credentials --- .gitea/workflows/build.yaml | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 56a6f6a..155976b 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -49,35 +49,27 @@ jobs: SHORT_SHA=$(git rev-parse --short HEAD) echo "short_sha=${SHORT_SHA}" >> $GITHUB_OUTPUT - - name: Validate registry credentials - run: | - if [ -z "${{ secrets.FORGEJO_REGISTRY_USER }}" ] || [ -z "${{ secrets.FORGEJO_REGISTRY_TOKEN }}" ]; then - echo "❌ ERROR: Registry secrets not configured" - echo "Set FORGEJO_REGISTRY_USER and FORGEJO_REGISTRY_TOKEN in repo settings" - exit 1 - fi - echo "✓ Registry credentials configured" - - name: Registry login run: | - echo "${{ secrets.FORGEJO_REGISTRY_TOKEN }}" | docker login "${{ env.REGISTRY }}" \ - --username "${{ secrets.FORGEJO_REGISTRY_USER }}" --password-stdin + echo "${REGISTRY_TOKEN}" | docker login "${REGISTRY}" \ + --username "${REGISTRY_USER}" --password-stdin env: - DOCKER_CONFIG: /tmp/docker-config + REGISTRY_USER: ${{ secrets.FORGEJO_REGISTRY_USER }} + REGISTRY_TOKEN: ${{ secrets.FORGEJO_REGISTRY_TOKEN }} - name: Build Docker image run: | docker build --no-cache \ - -t "${{ env.IMAGE }}:${{ steps.sha.outputs.short_sha }}" \ - -t "${{ env.IMAGE }}:latest" \ + -t "${IMAGE}:${{ steps.sha.outputs.short_sha }}" \ + -t "${IMAGE}:latest" \ -f Dockerfile \ . - name: Push Docker image run: | - docker push "${{ env.IMAGE }}:${{ steps.sha.outputs.short_sha }}" - docker push "${{ env.IMAGE }}:latest" - echo "✓ Image pushed: ${{ env.IMAGE }}:${{ steps.sha.outputs.short_sha }}" + docker push "${IMAGE}:${{ steps.sha.outputs.short_sha }}" + docker push "${IMAGE}:latest" + echo "✓ Image pushed: ${IMAGE}:${{ steps.sha.outputs.short_sha }}" - name: Prune unused images run: docker image prune -a --force 2>&1 | tail -3 || true