Skip to content

Commit

Permalink
Fix CI (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
djeebus authored Oct 3, 2024
1 parent b1e2be0 commit 2d7b205
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
12 changes: 8 additions & 4 deletions .github/actions/build-image/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand 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 }}
Expand All @@ -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 }}
2 changes: 2 additions & 0 deletions .github/workflows/on_pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ 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 }}

- uses: mshick/add-pr-comment@v2
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
1 change: 1 addition & 0 deletions .github/workflows/on_push_to_main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:

- uses: ./.github/actions/build-image
with:
push: 'true'
image_tag: ${{ env.GIT_TAG }}
token: ${{ secrets.GITHUB_TOKEN }}

Expand Down

0 comments on commit 2d7b205

Please sign in to comment.