mirror of
https://github.com/storytold/craft-common-actions.git
synced 2026-11-15 15:02:24 +00:00
feat(docker-build): support Docker Hub registry alongside DOCR and GHCR (#179)
This commit is contained in:
1 parent
3b3ea7ed62
commit
a5eda472ea
3 files changed
+70
-5
No files matched your search
@@ -20,7 +20,7 @@ on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
images:
|
||||
description: "Image repositories to push, one per line (registry.digitalocean.com/... and/or ghcr.io/...)"
|
||||
description: "Image repositories to push, one per line (registry.digitalocean.com/..., ghcr.io/... and/or docker.io/...)"
|
||||
type: string
|
||||
required: true
|
||||
platforms:
|
||||
@@ -91,10 +91,10 @@ on:
|
||||
description: "DigitalOcean token or DOCR robot with write access; used when an image lives in registry.digitalocean.com"
|
||||
required: false
|
||||
DOCKERHUB_USERNAME:
|
||||
description: "Docker Hub user for dhi.io base images; only read with dhi-login"
|
||||
description: "Docker Hub user for dhi.io base images and docker.io pushes; only read when configured"
|
||||
required: false
|
||||
DOCKERHUB_TOKEN:
|
||||
description: "Docker Hub token for dhi.io base images; only read with dhi-login"
|
||||
description: "Docker Hub token for dhi.io base images and docker.io pushes; only read when configured"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -161,6 +161,13 @@ jobs:
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
if: ${{ contains(inputs.images, 'docker.io/') }}
|
||||
uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # v4.7.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Set up Buildx
|
||||
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
|
||||
|
||||
@@ -186,7 +193,7 @@ jobs:
|
||||
image="${image//[[:space:]]/}"
|
||||
[ -n "$image" ] || continue
|
||||
case "$image" in
|
||||
registry.digitalocean.com/* | ghcr.io/*) ;;
|
||||
registry.digitalocean.com/* | ghcr.io/* | docker.io/*) ;;
|
||||
*)
|
||||
echo "error: unsupported image repository: $image" >&2
|
||||
exit 1
|
||||
@@ -273,6 +280,13 @@ jobs:
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
if: ${{ contains(inputs.images, 'docker.io/') }}
|
||||
uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # v4.7.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Set up Buildx
|
||||
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
|
||||
|
||||
|
||||
Reference in new issue
Block a user