From 2d7b205384f9bced03db1e6e7f037c9850d9a80f Mon Sep 17 00:00:00 2001 From: Joseph Lombrozo Date: Wed, 2 Oct 2024 21:57:19 -0400 Subject: [PATCH] Fix CI (#290) --- .github/actions/build-image/action.yaml | 12 ++++++++---- .github/workflows/on_pull_request.yaml | 2 ++ .github/workflows/on_push_to_main.yaml | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/actions/build-image/action.yaml b/.github/actions/build-image/action.yaml index ec7c1cbb..5a426ee1 100644 --- a/.github/actions/build-image/action.yaml +++ b/.github/actions/build-image/action.yaml @@ -5,6 +5,10 @@ inputs: image_tag: description: The image tag required: true + push: + description: True to push image after building, false otherwise + required: false + default: "false" tag_latest: description: Tag latest as well as the provided tag default: "false" @@ -21,7 +25,7 @@ runs: using: composite steps: - - uses: docker/setup-qemu-action@v1 + - uses: docker/setup-qemu-action@v3 with: image: tonistiigi/binfmt:latest platforms: all @@ -32,7 +36,7 @@ runs: with: { version: "v${{ env.EARTHLY_TOOL_VERSION }}" } - name: login to registry - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} @@ -42,8 +46,8 @@ runs: shell: bash run: >- ./earthly.sh - --push + ${{ inputs.push == 'true' && '--push' || '' }} +docker-multiarch - ${{ inputs.tag_latest != 'false' && format('--LATEST_IMAGE_NAME=ghcr.io/{0}:latest', github.repository) || '' }} + ${{ inputs.tag_latest != 'false' && format('--LATEST_IMAGE_NAME=ghcr.io/{0}:latest', github.repository) || '' }} --GIT_TAG=${{ inputs.image_tag }} --IMAGE_NAME=ghcr.io/${{ github.repository }}:${{ inputs.image_tag }} diff --git a/.github/workflows/on_pull_request.yaml b/.github/workflows/on_pull_request.yaml index 4cc4e68d..fa828f6f 100644 --- a/.github/workflows/on_pull_request.yaml +++ b/.github/workflows/on_pull_request.yaml @@ -32,6 +32,7 @@ jobs: - uses: ./.github/actions/build-image id: build-image with: + push: '${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}' image_tag: ${{ env.FS_TAG }} token: ${{ secrets.GITHUB_TOKEN }} @@ -39,3 +40,4 @@ jobs: with: message: | Temporary image available at `${{ steps.build-image.outputs.image }}`. + if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name diff --git a/.github/workflows/on_push_to_main.yaml b/.github/workflows/on_push_to_main.yaml index c3a9ac13..5ecb85f3 100644 --- a/.github/workflows/on_push_to_main.yaml +++ b/.github/workflows/on_push_to_main.yaml @@ -23,6 +23,7 @@ jobs: - uses: ./.github/actions/build-image with: + push: 'true' image_tag: ${{ env.GIT_TAG }} token: ${{ secrets.GITHUB_TOKEN }}