Skip to content

Commit

Permalink
chore: fix cache + don't build if image exist
Browse files Browse the repository at this point in the history
  • Loading branch information
albttx committed Sep 14, 2024
1 parent 83465e1 commit a83e637
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ jobs:
- juno
- nolus
- govgen

continue-on-error: true
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5

# TODO: first check if docker image not already exist

Expand Down Expand Up @@ -86,11 +89,21 @@ jobs:
type=raw,value=latest
type=raw,value=${{ steps.version.outputs.result }}
- name: Check if image already exist
id: image_exists
continue-on-error: true
uses: cloudposse/[email protected]
with:
image_name: "${{ github.repository }}/${{ matrix.chain }}"
registry: ghcr.io
tag: "${{ steps.version.outputs.result }}"

# TODO: Check if the directory have a custom Dockerfile
# in that case, build a different image

- name: Build and push
uses: docker/build-push-action@v3
if: "steps.image_exists.outcome == 'failure'"
with:
file: "./Dockerfile"
context: ./${{ matrix.chain }}
Expand Down

0 comments on commit a83e637

Please sign in to comment.