From 93fe86cbb76783dc6cb5eccfa2f96f35292c638e Mon Sep 17 00:00:00 2001 From: Brad Larsen Date: Thu, 7 Sep 2023 17:14:32 -0400 Subject: [PATCH] Attempt to fix Docker tagging snafu --- .github/workflows/docker-image.yml | 37 +++++++++++++------------ .github/workflows/release-artifacts.yml | 7 +++-- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 1ec335dbf..1c8126a06 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -3,7 +3,6 @@ name: Docker on: push: branches: [ "main" ] - tags: [ "v*.*.*" ] pull_request: branches: [ "main" ] @@ -11,16 +10,31 @@ jobs: build: name: Docker runs-on: ubuntu-22.04 + + env: + - NP_TAG: ghcr.io/${{ github.repository }}:edge + steps: - uses: actions/checkout@v3 - # - uses: docker/setup-qemu-action@v2 # for multi-platform build + + # The following for multi-platform build; disabled here because it takes so long; see #39. + # + # The docker image built for noseyparker releases is done in the + # `release-artifacts.yml` file. + # + # - uses: docker/setup-qemu-action@v2 + - uses: docker/setup-buildx-action@v2 - name: Build Docker image uses: docker/build-push-action@v4 with: - tags: noseyparker + tags: ${{ env: NP_TAG }} + + # For multi-platform builds + # # platforms: linux/amd64,linux/arm64 + load: true cache-from: type=gha cache-to: type=gha,mode=max @@ -34,7 +48,7 @@ jobs: org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }} - name: Test the Docker image - run: docker run --rm noseyparker --help + run: docker run --rm "$NP_TAG" --help - name: Login to github container registry if: github.event_name != 'pull_request' @@ -47,17 +61,4 @@ jobs: - name: Push the image to `edge` if: github.event_name == 'push' && github.ref_name == 'main' run: | - docker tag noseyparker ghcr.io/${{ github.repository }}:edge - docker push ghcr.io/${{ github.repository }}:edge - - - name: Push the image to `${{ github.ref_name }}` - if: github.ref_type == 'tag' - run: | - docker tag noseyparker ghcr.io/${{ github.repository }}:${{ github.ref_name }} - docker push ghcr.io/${{ github.repository }}:${{ github.ref_name }} - - - name: Push the image to `latest` - if: github.ref_type == 'tag' - run: | - docker tag noseyparker ghcr.io/${{ github.repository }}:latest - docker push ghcr.io/${{ github.repository }}:latest + docker push "$NP_TAG" diff --git a/.github/workflows/release-artifacts.yml b/.github/workflows/release-artifacts.yml index 807f99612..8885b0697 100644 --- a/.github/workflows/release-artifacts.yml +++ b/.github/workflows/release-artifacts.yml @@ -3,7 +3,8 @@ name: Release Artifacts on: push: # The multiplatform Docker image is expensive to build (3h), so we are not - # currently running it for every commit to `main` + # currently running it for every commit to `main`. + # See #39 for more context. # # branches: [ "main" ] @@ -59,7 +60,9 @@ jobs: platforms: linux/amd64,linux/arm64 push: true - tags: ghcr.io/${{ github.repository }}:experimental-multiplatform + tags: + - ghcr.io/${{ github.repository }}:${{ github.ref_name }} + - ghcr.io/${{ github.repository }}:latest labels: | org.opencontainers.image.title=${{ github.event.repository.name }}