Skip to content

Commit

Permalink
support building an image for prs (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
djeebus authored Aug 18, 2023
1 parent 415b63d commit f1228c3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
30 changes: 26 additions & 4 deletions .github/workflows/on_pull_request.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
name: pr_build

on:
pull_request:
paths:
- '*'
- '*/**'
- '!README.md'
- '!.tool-versions'
- '!COPYING.LGPL-3'
- '!.gitattributes'
- '!.gitignore'

env:
FS_IMAGE: ttl.sh/${{ github.repository }}/pr-${{ github.event.pull_request.number }}/${{ github.event.pull_request.head.sha }}
FS_TAG: 24h

# TODO: Move this to repo config
jobs:
build:
runs-on: ubuntu-22.04

permissions:
contents: read
packages: write
pull-requests: write

strategy:
matrix:
platform:
Expand All @@ -38,13 +47,26 @@ jobs:
# Reads in .tools-versions and spits out env variables
- uses: wistia/[email protected]

- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: earthly/actions-setup@v1
with: { version: "v${{ env.EARTHLY_TOOL_VERSION }}" }

- run: |
earthly \
--push \
--platform ${{ matrix.platform }} \
+docker \
+docker-tag \
--GIT_COMMIT=${{ env.GIT_SHA_SHORT }} \
--GIT_TAG=mr \
--GOLANG_VERSION=${{ env.GOLANG_TOOL_VERSION }}
--GIT_TAG=${{ env.FS_TAG }} \
--GOLANG_VERSION=${{ env.GOLANG_TOOL_VERSION }} \
--CI_REGISTRY_IMAGE=${{ env.FS_IMAGE }}
- uses: mshick/add-pr-comment@v2
with:
message: |
Temporary image available at `${{ env.FS_IMAGE }}:${{ env.FS_TAG }}` for 24 hours. If you need another built, close and reopen the PR.
File renamed without changes.
1 change: 0 additions & 1 deletion Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ docker-tag:
ARG CI_REGISTRY_IMAGE="ghcr.io/zapier/kubechecks"
ARG --required GIT_TAG

SAVE IMAGE --push $CI_REGISTRY_IMAGE:latest
SAVE IMAGE --push $CI_REGISTRY_IMAGE:$GIT_TAG

dlv:
Expand Down

0 comments on commit f1228c3

Please sign in to comment.