Skip to content

Commit

Permalink
change: split build job
Browse files Browse the repository at this point in the history
  • Loading branch information
ponkio-o committed May 1, 2024
1 parent 89602bc commit bea260b
Showing 1 changed file with 52 additions and 2 deletions.
54 changes: 52 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,67 @@ 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

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
Expand Down

0 comments on commit bea260b

Please sign in to comment.