@@ -28,16 +28,96 @@ jobs:
2828 run : |
2929 echo version=$(cat VERSION) >> $GITHUB_OUTPUT
3030
31+ - name : Detect platform
32+ id : platform
33+ run : |
34+ if [[ "${{ matrix.runner }}" == *"arm"* ]]; then
35+ echo "platform=linux/arm64" >> $GITHUB_OUTPUT
36+ echo "arch-tag=arm64" >> $GITHUB_OUTPUT
37+ else
38+ echo "platform=linux/amd64" >> $GITHUB_OUTPUT
39+ echo "arch-tag=amd64" >> $GITHUB_OUTPUT
40+ fi
41+
3142 - name : Setup Golang
3243 uses : actions/setup-go@v6
3344 with :
3445 go-version-file : go.mod
3546
36- - name : Build and push image
47+ - name : Build and push platform-specific image
3748 run : |
38- set -ex
39- docker login --username "${DOCKER_USERNAME}" --password "${DOCKER_PASSWORD}" quay.io
40- IMAGE_TAG=v${{ steps.version.outputs.version }} make docker-build docker-push
49+ set -euo pipefail
50+ echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin quay.io
51+ IMAGE_TAG="v${{ steps.version.outputs.version }}-${{ steps.platform.outputs.arch-tag }}" make docker-build docker-push
52+ env :
53+ DOCKER_USERNAME : ${{ secrets.QUAY_USERNAME }}
54+ DOCKER_PASSWORD : ${{ secrets.QUAY_TOKEN }}
55+
56+ create-manifest :
57+ name : Create multi-arch manifest
58+ needs : build-push-images
59+ runs-on : ubuntu-latest
60+ timeout-minutes : 30
61+ if : needs.build-push-images.result == 'success'
62+ steps :
63+ - name : Checkout code
64+ uses : actions/checkout@v5
65+
66+ - name : Get version
67+ id : version
68+ run : |
69+ echo version=$(cat VERSION) >> $GITHUB_OUTPUT
70+
71+ - name : Login to registry
72+ run : |
73+ set -euo pipefail
74+ echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin quay.io
4175 env :
4276 DOCKER_USERNAME : ${{ secrets.QUAY_USERNAME }}
4377 DOCKER_PASSWORD : ${{ secrets.QUAY_TOKEN }}
78+
79+ - name : Create and push multi-arch manifest
80+ run : |
81+ set -ex
82+ IMAGE_NAME="quay.io/argoprojlabs/argocd-image-updater"
83+ VERSION_TAG="v${{ steps.version.outputs.version }}"
84+
85+ # Build list of platform-specific tags that exist
86+ MANIFEST_TAGS=""
87+
88+ # Check if amd64 image exists
89+ if docker manifest inspect ${IMAGE_NAME}:${VERSION_TAG}-amd64 >/dev/null 2>&1; then
90+ MANIFEST_TAGS="${MANIFEST_TAGS} ${IMAGE_NAME}:${VERSION_TAG}-amd64"
91+ fi
92+
93+ # Check if arm64 image exists
94+ if docker manifest inspect ${IMAGE_NAME}:${VERSION_TAG}-arm64 >/dev/null 2>&1; then
95+ MANIFEST_TAGS="${MANIFEST_TAGS} ${IMAGE_NAME}:${VERSION_TAG}-arm64"
96+ fi
97+
98+ # Remove leading space
99+ MANIFEST_TAGS=$(echo ${MANIFEST_TAGS} | sed 's/^ //')
100+
101+ if [ -z "${MANIFEST_TAGS}" ]; then
102+ echo "No platform-specific images found, skipping manifest creation"
103+ exit 0
104+ fi
105+
106+ # Create manifest list
107+ docker manifest create ${IMAGE_NAME}:${VERSION_TAG} ${MANIFEST_TAGS}
108+
109+ # Annotate each platform that exists
110+ if docker manifest inspect ${IMAGE_NAME}:${VERSION_TAG}-amd64 >/dev/null 2>&1; then
111+ docker manifest annotate ${IMAGE_NAME}:${VERSION_TAG} \
112+ ${IMAGE_NAME}:${VERSION_TAG}-amd64 \
113+ --os linux --arch amd64
114+ fi
115+
116+ if docker manifest inspect ${IMAGE_NAME}:${VERSION_TAG}-arm64 >/dev/null 2>&1; then
117+ docker manifest annotate ${IMAGE_NAME}:${VERSION_TAG} \
118+ ${IMAGE_NAME}:${VERSION_TAG}-arm64 \
119+ --os linux --arch arm64
120+ fi
121+
122+ # Push the manifest
123+ docker manifest push ${IMAGE_NAME}:${VERSION_TAG}
0 commit comments