Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 39 additions & 4 deletions .github/workflows/docker-constructive.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ jobs:
env:
REPO: ghcr.io/${{ github.repository_owner }}
IMAGE_NAME: constructive
DOCKERHUB_IMAGE: constructiveio/constructive

steps:
- name: Set up Docker Buildx
Expand All @@ -135,14 +136,20 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Download digests
uses: actions/download-artifact@v4
with:
pattern: digests-*
path: ${{ runner.temp }}/digests
merge-multiple: true

- name: Extract metadata
- name: Extract metadata (GHCR)
id: meta
uses: docker/metadata-action@v5
with:
Expand All @@ -155,7 +162,20 @@ jobs:
type=sha,format=short,prefix=
type=raw,value=latest,enable={{is_default_branch}}

- name: Create and push multi-arch manifests
- name: Extract metadata (Docker Hub)
id: meta-dockerhub
uses: docker/metadata-action@v5
with:
images: docker.io/${{ env.DOCKERHUB_IMAGE }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,format=short,prefix=
type=raw,value=latest,enable={{is_default_branch}}

- name: Create and push multi-arch manifests (GHCR)
run: |
set -euo pipefail

Expand All @@ -178,12 +198,27 @@ jobs:
exit 1
fi

echo "Creating manifests for tags:"
echo "Creating GHCR manifests for tags:"
echo "${{ steps.meta.outputs.tags }}"

# metadata-action outputs tags as a newline-separated list
echo "${{ steps.meta.outputs.tags }}" | while read -r tag; do
[ -z "$tag" ] && continue
echo "Creating multi-arch manifest for $tag"
docker buildx imagetools create -t "$tag" $digests
done

- name: Copy multi-arch manifests to Docker Hub
if: github.ref == 'refs/heads/main'
run: |
set -euo pipefail

ghcr_image="${{ env.REPO }}/${{ env.IMAGE_NAME }}"

echo "Copying manifests to Docker Hub:"
echo "${{ steps.meta-dockerhub.outputs.tags }}"

echo "${{ steps.meta-dockerhub.outputs.tags }}" | while read -r tag; do
[ -z "$tag" ] && continue
echo "Copying to $tag"
docker buildx imagetools create -t "$tag" "${ghcr_image}:latest"
done
Loading