From 33cd306ec29e1006f0623bd8e7655d0356df3595 Mon Sep 17 00:00:00 2001 From: Louis Orleans Date: Fri, 1 Sep 2023 11:05:51 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=9A=20fix=20platforms=202:=20electric?= =?UTF-8?q?=20boogaloo=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-publish.yaml | 3 ++- .../scripts/convert-arch-to-platform.sh | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100755 .github/workflows/scripts/convert-arch-to-platform.sh diff --git a/.github/workflows/build-publish.yaml b/.github/workflows/build-publish.yaml index 549efa7..17a4a03 100644 --- a/.github/workflows/build-publish.yaml +++ b/.github/workflows/build-publish.yaml @@ -43,7 +43,8 @@ jobs: - name: 'Set target build platforms 📝' id: 'target-platforms' run: | - echo "target_platforms=linux/amd64,linux/${{ steps.qemu.outputs.platforms }}/v8" >> "$GITHUB_OUTPUT" + qemu_platforms="$(.github/workflows/scripts/convert-arch-to-platform.sh "${{ steps.qemu.outputs.platforms }}")" + echo "target_platforms=$qemu_platforms" >> "$GITHUB_OUTPUT" - name: 'Build container 🐳' id: 'build' diff --git a/.github/workflows/scripts/convert-arch-to-platform.sh b/.github/workflows/scripts/convert-arch-to-platform.sh new file mode 100755 index 0000000..1f7449e --- /dev/null +++ b/.github/workflows/scripts/convert-arch-to-platform.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +qemu_platforms="" + +for p in $(echo "$1" | tr ',' '\n'); do + v="" + case "$p" in + "linux/arm64") + v="$p/v8" ;; + # Skip platforms we don't need + "linux/386") ;; + *) + v="$p" ;; + esac + + if [ -z "$qemu_platforms" ]; then + qemu_platforms="$v" + else + qemu_platforms="$qemu_platforms,$v" + fi +done + +echo "$qemu_platforms"