From 95854ddd0590010ea32e4f29497457d58bef7bcf Mon Sep 17 00:00:00 2001 From: Stephen Simpson Date: Fri, 24 Oct 2025 12:33:56 -0500 Subject: [PATCH] Refactor registry handling in Docker workflow to use RUNNER_REGISTRY environment variable Signed-off-by: Stephen Simpson --- .gitea/workflows/docker-image-linux.yml | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/docker-image-linux.yml b/.gitea/workflows/docker-image-linux.yml index d80135f..e2c25ae 100644 --- a/.gitea/workflows/docker-image-linux.yml +++ b/.gitea/workflows/docker-image-linux.yml @@ -15,16 +15,27 @@ env: jobs: build-and-push: runs-on: ubuntu-latest - env: - REGISTRY: ${{ runner.labels.filter(l => l.startsWith('registry=')).map(l => l.split('=')[1]).first() || 'gitea.sjs.io' }} - container: - image: gitea/runner-images:ubuntu-latest permissions: contents: read packages: write steps: + - name: Get Registry + id: registry + run: | + # Use RUNNER_REGISTRY environment variable + if [ ! -z "${RUNNER_REGISTRY}" ]; then + REGISTRY="${RUNNER_REGISTRY}" + else + echo "ERROR: RUNNER_REGISTRY environment variable not set" + echo "Please add RUNNER_REGISTRY to your runner's environment variables" + exit 1 + fi + + echo "registry=${REGISTRY}" >> $GITHUB_OUTPUT + echo "Using registry: ${REGISTRY}" + - name: Checkout code uses: actions/checkout@v4 @@ -37,7 +48,7 @@ jobs: - name: Log in to registry uses: docker/login-action@v3 with: - registry: ${{ env.REGISTRY }} + registry: ${{ steps.registry.outputs.registry }} username: ${{ vars.USERNAME }} password: ${{ secrets.PASS }} @@ -45,7 +56,7 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: ${{ env.REGISTRY }}/${{ vars.USERNAME }}/${{ env.IMAGE_NAME }} + images: ${{ steps.registry.outputs.registry }}/${{ vars.USERNAME }}/${{ env.IMAGE_NAME }} tags: | # Only tag with version and latest on tag push type=semver,pattern={{version}},enable=${{ startsWith(github.ref, 'refs/tags/') }}