From 1f9e0b8f8a0de132c9a460fb4cce319c31ad2b1f Mon Sep 17 00:00:00 2001 From: Mike Brancato Date: Sun, 7 Jun 2026 13:42:21 -0400 Subject: [PATCH] Normalize docker repo target --- .github/workflows/rebuild-latest-release.yaml | 17 +++++++++++++---- .github/workflows/release.yaml | 17 +++++++++++++---- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/.github/workflows/rebuild-latest-release.yaml b/.github/workflows/rebuild-latest-release.yaml index 253e8e9..65d269a 100644 --- a/.github/workflows/rebuild-latest-release.yaml +++ b/.github/workflows/rebuild-latest-release.yaml @@ -7,8 +7,6 @@ on: env: GHCR_REPO: ghcr.io/${{ github.repository }} - DOCKERHUB_REPO_NAME: ${{ vars.DOCKER_REPO }} - DOCKERHUB_REPO: docker.io/${{ vars.DOCKER_REPO }} GOTOOLCHAIN: local permissions: @@ -81,13 +79,24 @@ jobs: - name: Run tests run: go test -count 1 -v ./... + - name: Normalize Docker Hub repository + id: docker-repo + env: + DOCKER_REPO: ${{ vars.DOCKER_REPO }} + run: | + set -euo pipefail + REPOSITORY="${DOCKER_REPO#docker.io/}" + test -n "${REPOSITORY}" || { echo "DOCKER_REPO is not configured"; exit 1; } + echo "DOCKERHUB_REPO=docker.io/${REPOSITORY}" >> "$GITHUB_ENV" + echo "repository=docker.io/${REPOSITORY}" >> "$GITHUB_OUTPUT" + - name: Validate registry configuration env: DOCKERHUB_USERNAME: ${{ vars.DOCKERHUB_USERNAME }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} run: | set -euo pipefail - test -n "${DOCKERHUB_REPO_NAME}" || { echo "DOCKER_REPO is not configured"; exit 1; } + test -n "${DOCKERHUB_REPO}" || { echo "DOCKER_REPO is not configured"; exit 1; } test -n "${DOCKERHUB_USERNAME}" || { echo "DOCKERHUB_USERNAME is not configured"; exit 1; } test -n "${DOCKERHUB_TOKEN}" || { echo "DOCKERHUB_TOKEN is not configured"; exit 1; } @@ -175,6 +184,6 @@ jobs: - name: Attest Docker Hub build provenance uses: actions/attest-build-provenance@v4 with: - subject-name: ${{ env.DOCKERHUB_REPO }} + subject-name: ${{ steps.docker-repo.outputs.repository }} subject-digest: ${{ steps.image.outputs.digest }} push-to-registry: true diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 76e1b46..ee18161 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -6,8 +6,6 @@ on: env: GHCR_REPO: ghcr.io/${{ github.repository }} - DOCKERHUB_REPO_NAME: ${{ vars.DOCKER_REPO }} - DOCKERHUB_REPO: docker.io/${{ vars.DOCKER_REPO }} RELEASE_TAG: ${{ github.event.release.tag_name }} GOTOOLCHAIN: local @@ -60,13 +58,24 @@ jobs: - name: Run tests run: go test -count 1 -v ./... + - name: Normalize Docker Hub repository + id: docker-repo + env: + DOCKER_REPO: ${{ vars.DOCKER_REPO }} + run: | + set -euo pipefail + REPOSITORY="${DOCKER_REPO#docker.io/}" + test -n "${REPOSITORY}" || { echo "DOCKER_REPO is not configured"; exit 1; } + echo "DOCKERHUB_REPO=docker.io/${REPOSITORY}" >> "$GITHUB_ENV" + echo "repository=docker.io/${REPOSITORY}" >> "$GITHUB_OUTPUT" + - name: Validate registry configuration env: DOCKERHUB_USERNAME: ${{ vars.DOCKERHUB_USERNAME }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} run: | set -euo pipefail - test -n "${DOCKERHUB_REPO_NAME}" || { echo "DOCKER_REPO is not configured"; exit 1; } + test -n "${DOCKERHUB_REPO}" || { echo "DOCKER_REPO is not configured"; exit 1; } test -n "${DOCKERHUB_USERNAME}" || { echo "DOCKERHUB_USERNAME is not configured"; exit 1; } test -n "${DOCKERHUB_TOKEN}" || { echo "DOCKERHUB_TOKEN is not configured"; exit 1; } @@ -180,6 +189,6 @@ jobs: - name: Attest Docker Hub build provenance uses: actions/attest-build-provenance@v4 with: - subject-name: ${{ env.DOCKERHUB_REPO }} + subject-name: ${{ steps.docker-repo.outputs.repository }} subject-digest: ${{ steps.image.outputs.digest }} push-to-registry: true