Skip to content

Commit 8e38d8b

Browse files
committed
workflow: mirror all architectures to ghcr
Thanks to accidentally publishing jimschubert/docked temporarily over jimschubert/labeler, then manually adjusting, I realized my initial implementation of ghcr mirroring only mirrored the linux/amd64 bits. this updates to mirror everything, including attestations.
1 parent 31ccdf5 commit 8e38d8b

1 file changed

Lines changed: 21 additions & 12 deletions

File tree

.github/workflows/build.yml

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,25 @@ jobs:
5151
username: ${{ github.actor }}
5252
password: ${{ secrets.GITHUB_TOKEN }}
5353

54-
- name: Pull and push images
55-
run: |
56-
# Pull from Docker Hub and push to GHCR
57-
docker pull jimschubert/labeler:${{ steps.version.outputs.tag }}
58-
docker tag jimschubert/labeler:${{ steps.version.outputs.tag }} ghcr.io/jimschubert/labeler/labeler:${{ steps.version.outputs.tag }}
59-
docker tag jimschubert/labeler:${{ steps.version.outputs.tag }} ghcr.io/jimschubert/labeler/labeler:v${{ steps.version.outputs.major }}
60-
docker tag jimschubert/labeler:${{ steps.version.outputs.tag }} ghcr.io/jimschubert/labeler/labeler:v${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}
61-
docker tag jimschubert/labeler:${{ steps.version.outputs.tag }} ghcr.io/jimschubert/labeler/labeler:latest
54+
- name: Set up Docker Buildx
55+
uses: docker/setup-buildx-action@v3
6256

63-
docker push ghcr.io/jimschubert/labeler/labeler:${{ steps.version.outputs.tag }}
64-
docker push ghcr.io/jimschubert/labeler/labeler:v${{ steps.version.outputs.major }}
65-
docker push ghcr.io/jimschubert/labeler/labeler:v${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}
66-
docker push ghcr.io/jimschubert/labeler/labeler:latest
57+
- name: Mirror multi-platform images to GHCR
58+
run: |
59+
# Use buildx imagetools to mirror all platforms from Docker Hub to GHCR
60+
SOURCE_IMAGE="jimschubert/labeler:${{ steps.version.outputs.tag }}"
61+
TARGET_IMAGE="ghcr.io/jimschubert/labeler/labeler"
62+
63+
# Inspect source to verify it exists and show platforms
64+
echo "Source image platforms:"
65+
docker buildx imagetools inspect ${SOURCE_IMAGE}
66+
67+
# Mirror all platforms with multiple tags
68+
docker buildx imagetools create \
69+
--tag ${TARGET_IMAGE}:${{ steps.version.outputs.tag }} \
70+
--tag ${TARGET_IMAGE}:v${{ steps.version.outputs.major }} \
71+
--tag ${TARGET_IMAGE}:v${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }} \
72+
--tag ${TARGET_IMAGE}:latest \
73+
${SOURCE_IMAGE}
74+
75+
echo "Successfully mirrored all platforms to GHCR"

0 commit comments

Comments
 (0)