From bea260b7771e86ef29fb031bd0d1a4007b2769f7 Mon Sep 17 00:00:00 2001 From: ponkio-o <29038315+ponkio-o@users.noreply.github.com> Date: Wed, 1 May 2024 15:35:02 +0900 Subject: [PATCH] change: split build job --- .github/workflows/release.yml | 54 +++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 20edf6f..59d1767 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,8 +6,60 @@ on: - "v*" jobs: + # Build first because some Dockerfiles depend on the builder image + build-and-push-builder: + name: Build and push container image (builder) + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 + with: + submodules: recursive + + - uses: nowsprinting/check-version-format-action@98485692a883d962227b09f40f29a63de0771299 # v4.0.2 + id: version + with: + prefix: "v" + + - name: Set up QEMU + uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 + + - name: Login to ghcr.io + uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0 + with: + platforms: linux/amd64,linux/arm64 + file: build.Dockerfile + tags: ghcr.io/dena/unity-meta-check/unity-meta-check-builder:${{ github.ref_name }} + push: true + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Add latest tag + if: steps.version.outputs.is_stable == 'true' + uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0 + with: + platforms: linux/amd64,linux/arm64 + file: ghcr.io/dena/unity-meta-check/unity-meta-check-builder + tags: ghcr.io/dena/unity-meta-check/unity-meta-check-builder:latest + push: true + cache-from: type=gha + cache-to: type=gha,mode=max + build-and-push: name: Build and push container image + needs: build-and-push-builder runs-on: ubuntu-latest permissions: contents: read @@ -15,8 +67,6 @@ jobs: strategy: matrix: images: - - dockerfile: ./build.Dockerfile - image_name: ghcr.io/dena/unity-meta-check/unity-meta-check-builder - dockerfile: ./Dockerfile image_name: ghcr.io/dena/unity-meta-check/unity-meta-check - dockerfile: ./.github/images/Dockerfile