From d002b0f2f8916434a2ce31722548a451e6cc588d Mon Sep 17 00:00:00 2001 From: Brian Rosner Date: Mon, 26 May 2025 19:52:58 -0600 Subject: [PATCH] use multiple runners for the multi-arch build --- .gitea/workflows/ci.yml | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index e8689e1..8cc841c 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -63,46 +63,42 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} build: name: Build and push image - runs-on: ${{ matrix.runner }} + runs-on: ${{ matrix.arch.runner }} strategy: matrix: - runner: [ubuntu-latest, ubuntu-arm-latest] + arch: + - runner: ubuntu-latest + platform: linux/amd64 + - runner: ubuntu-arm-latest + platform: linux/arm64 permissions: packages: write needs: tests steps: - uses: actions/checkout@v4 + - name: Prepare + run: | + platform=${{ matrix.arch.platform }} + echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV + - name: Generate metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - name: Login to the Container Registry uses: docker/login-action@v3 with: registry: brosner.dev username: brosner password: ${{ secrets.CI_TOKEN }} - - name: Generate metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=ref,event=branch - type=ref,event=pr - type=sha - labels: | - org.opencontainers.image.title=teufa - org.opencontainers.image.description=teufa container image - org.opencontainers.image.source=https://brosner.dev/brosner/teufa - org.opencontainers.image.licenses=MIT - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - name: Setup docker buildx uses: docker/setup-buildx-action@v3 - name: Build image uses: docker/build-push-action@v6 - if: gitea.ref == 'refs/heads/main' with: - tags: ${{ steps.meta.outputs.tags }} + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} labels: ${{ steps.meta.outputs.labels }} annotations: ${{ steps.meta.outputs.annotations }} target: prod - platforms: ${{ matrix.runner == 'ubuntu-latest' && 'linux/amd64' || 'linux/arm64' }} - push: true + platforms: ${{ matrix.arch.platform }} + outputs: type=image,push-by-digest=true,name-canonical=true,push=true