Skip to content

Commit

Permalink
fix(ci): incorrect usage for quay.io
Browse files Browse the repository at this point in the history
Two simultaneous logins are ok for different registries.
A single instance of docker/build-push-action is enough, provided
that docker/metadata-action is fed both the unqualified image and
quay.io/... image.
  • Loading branch information
panchoh committed Jan 11, 2025
1 parent c5d05d4 commit 7b3fcba
Showing 1 changed file with 14 additions and 25 deletions.
39 changes: 14 additions & 25 deletions .github/workflows/build-n-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ jobs:
run: |
echo defined=$(test -n "${{ secrets.DOCKERHUB_USERNAME }}" && echo true || echo false) >> $GITHUB_OUTPUT
- name: Check Quay.io credentials
id: quayio-credentials
run: |
echo defined=$(test -n "${{ secrets.QUAYIO_USERNAME }}" && echo true || echo false) >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@53851d14592bedcffcf25ea515637cff71ef929a # v3.3.0

Expand All @@ -39,6 +44,14 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Login to Quay.io
if: steps.quayio-credentials.outputs.defined == 'true'
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: quay.io
username: ${{ secrets.QUAYIO_USERNAME }}
password: ${{ secrets.QUAYIO_PASSWORD }}

- name: Get release
id: release
run: |
Expand All @@ -56,6 +69,7 @@ jobs:
with:
images: |
${{ github.repository_owner }}/dnsmasq
quay.io/${{ github.repository_owner }}/dnsmasq
tags: |
${{ matrix.version.tag != 'edge' && format('{0}', matrix.version.dnsmasq) || '' }}
${{ format('{0}-alpine-{1}', matrix.version.dnsmasq, steps.release.outputs.rel) || '' }}
Expand All @@ -76,31 +90,6 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Check Quay.io credentials
id: quayio-credentials
run: |
echo defined=$(test -n "${{ secrets.QUAYIO_USERNAME }}" && echo true || echo false) >> $GITHUB_OUTPUT
- name: Login to Quay.io
if: steps.quayio-credentials.outputs.defined == 'true'
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: quay.io
username: ${{ secrets.QUAYIO_USERNAME }}
password: ${{ secrets.QUAYIO_PASSWORD }}

- name: Build and push
if: steps.quayio-credentials.outputs.defined == 'true'
id: quayio_build
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
build-args: ALPINE_RELEASE=${{ steps.release.outputs.rel }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Image digest
run: |
echo ${{ steps.docker_build.outputs.digest }}

0 comments on commit 7b3fcba

Please sign in to comment.