Skip to content

Commit

Permalink
Attempt to fix Docker tagging snafu
Browse files Browse the repository at this point in the history
bradlarsen committed Sep 7, 2023
1 parent 98a9176 commit 93fe86c
Showing 2 changed files with 24 additions and 20 deletions.
37 changes: 19 additions & 18 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -3,24 +3,38 @@ name: Docker
on:
push:
branches: [ "main" ]
tags: [ "v*.*.*" ]
pull_request:
branches: [ "main" ]

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"
7 changes: 5 additions & 2 deletions .github/workflows/release-artifacts.yml
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit 93fe86c

Please sign in to comment.