Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading