From 9e7db3022460274b09862465e62527f5c119ad7e Mon Sep 17 00:00:00 2001 From: Reuben Miller Date: Sun, 3 Dec 2023 16:51:40 +0100 Subject: [PATCH] ci: use build matrix to build images and variants (#14) --- .github/workflows/bake-image.yml | 44 +++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/.github/workflows/bake-image.yml b/.github/workflows/bake-image.yml index 2d16dca..19db04d 100644 --- a/.github/workflows/bake-image.yml +++ b/.github/workflows/bake-image.yml @@ -1,38 +1,52 @@ name: Bake Image on: + workflow_dispatch: push: branches: - main - ci -env: - PI_BASE_IMAGE: "https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2023-10-10/2023-10-10-raspios-bookworm-arm64-lite.img.xz" - jobs: + info: + name: Build information + runs-on: ubuntu-latest + outputs: + version: ${{ steps.step1.outputs.version }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: extractions/setup-just@v1 + - id: step1 + run: echo "version=$(just generate_version)" >> "$GITHUB_OUTPUT" + bake-image: - name: Bake Image + name: Bake Image ${{ matrix.job.arch }} - ${{ matrix.job.profile }} - ${{ matrix.job.variant }} runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + job: + - { arch: armhf, profile: armhf, variant: pi01 } + - { arch: arm64, profile: default, variant: pi023 } + - { arch: arm64, profile: default, variant: pi4 } + - { arch: arm64, profile: default, variant: pi45 } steps: - uses: actions/checkout@v3 with: submodules: recursive - - uses: extractions/setup-just@v1 - - - name: Install QEMU - run: docker run --privileged --rm tonistiigi/binfmt --install arm64,armhf - - - name: Set image version - run: echo "VERSION=$(just generate_version)" >> $GITHUB_ENV - - name: Build image + env: + VERSION: ${{needs.info.outputs.version}} run: | mkdir build - just build-all-variants + just IMAGE_ARCH=${{ matrix.job.arch }} PROFILE=${{ matrix.job.profile }} VARIANT=${{ matrix.job.variant }} build-all - name: Upload Image uses: actions/upload-artifact@v3 with: - name: images - path: build/*.xz + name: tedge_rugpi_${{matrix.job.profile}}_${{matrix.job.variant}}_${{version}} + path: build/tedge_rugpi_${{matrix.job.profile}}_${{matrix.job.variant}}_${{version}}*.xz