Skip to content

Commit 2ac3189

Browse files
committed
feat: deploy multi-arch images
1 parent d88dda1 commit 2ac3189

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed

.github/workflows/multiarch.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Deploy multi-arch images
2+
3+
on:
4+
workflow_dispatch:
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
8+
cancel-in-progress: false
9+
10+
jobs:
11+
deploy:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Deploy
16+
if: github.event_name == 'workflow_dispatch' && github.repository == 'pypa/manylinux'
17+
run: ./deploy_multiarch.sh
18+
env:
19+
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
20+
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}

deploy_multiarch.sh

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
IMAGES=(manylinux2014 manylinux_2_28 manylinux_2_31 manylinux_2_34 musllinux_1_2)
6+
#IMAGES=(manylinux_2_28 manylinux_2_31 manylinux_2_34 musllinux_1_2)
7+
8+
#IMAGES=(manylinux2014)
9+
podman login -u "${QUAY_USERNAME}" -p "${QUAY_PASSWORD}" quay.io
10+
11+
for IMAGE in "${IMAGES[@]}"; do
12+
LAST_TAG="$(oras repo tags --last "2025.02.23-1" "quay.io/pypa/${IMAGE}" | tail -2 | head -1)"
13+
if [ "${LAST_TAG}" == "" ]; then
14+
LAST_TAG=2025.02.23-1
15+
fi
16+
echo "${IMAGE}: last tag is ${LAST_TAG}"
17+
case ${IMAGE} in
18+
manylinux_2_31) REF_IMAGE=manylinux_2_31_armv7l;;
19+
*) REF_IMAGE=${IMAGE}_x86_64;;
20+
esac
21+
TAGS_TO_PUSH=()
22+
while IFS='' read -r LINE; do
23+
TAGS_TO_PUSH+=("$LINE");
24+
done < <(oras repo tags --last "${LAST_TAG}" "quay.io/pypa/${REF_IMAGE}" | grep -v "^20[0-9][0-9]-" | grep -v 2025.03 | grep -v "latest")
25+
if [ ${#TAGS_TO_PUSH[@]} -eq 0 ]; then
26+
echo "${IMAGE}: up-to-date"
27+
continue
28+
fi
29+
echo "${IMAGE}: ${TAGS_TO_PUSH[*]}"
30+
case ${IMAGE} in
31+
manylinux_2_31) ARCHS=("armv7l");;
32+
manylinux2014) ARCHS=("x86_64" "i686" "aarch64" "ppc64le" "s390x");;
33+
musllinux_1_2) ARCHS=("x86_64" "i686" "aarch64" "armv7l" "ppc64le" "s390x");;
34+
*) ARCHS=("x86_64" "aarch64" "ppc64le" "s390x");;
35+
esac
36+
37+
LATEST_MANIFEST=
38+
for TAG_TO_PUSH in "${TAGS_TO_PUSH[@]}"; do
39+
SRC_IMAGES=()
40+
for ARCH in "${ARCHS[@]}"; do
41+
SRC_IMAGES+=("docker://quay.io/pypa/${IMAGE}_${ARCH}:${TAG_TO_PUSH}")
42+
done
43+
MANIFEST="${IMAGE}:${TAG_TO_PUSH}"
44+
if ! podman manifest create "${MANIFEST}" "${SRC_IMAGES[@]}"; then
45+
echo "::error ::failed to create '${MANIFEST}' manifest using ${SRC_IMAGES[*]}"
46+
continue
47+
fi
48+
if ! podman manifest push --all "${MANIFEST}" "docker://quay.io/pypa/${IMAGE}:${TAG_TO_PUSH}"; then
49+
echo "::error ::failed to push 'quay.io/pypa/${IMAGE}:${TAG_TO_PUSH}' using '${MANIFEST}'"
50+
else
51+
LATEST_MANIFEST="${MANIFEST}"
52+
fi
53+
done
54+
if [ "${LATEST_MANIFEST}" == "" ]; then
55+
echo "::warning ::${IMAGE}: skipping latest due to previous errors"
56+
continue
57+
fi
58+
if ! podman manifest push --all "${LATEST_MANIFEST}" "docker://quay.io/pypa/${IMAGE}:latest"; then
59+
echo "::error ::failed to push 'quay.io/pypa/${IMAGE}:latest' using '${LATEST_MANIFEST}'"
60+
fi
61+
done

0 commit comments

Comments
 (0)