Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions .github/workflows/rebuild-latest-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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; }

Expand Down Expand Up @@ -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
17 changes: 13 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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; }

Expand Down Expand Up @@ -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