From 2ff6c713fab9dd3b023652bab5c08f5deb8281b3 Mon Sep 17 00:00:00 2001 From: albttx Date: Sat, 14 Sep 2024 09:45:47 +0100 Subject: [PATCH] chore: fix cache + don't build if image exist --- .github/workflows/docker.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 2b4e9f6..2d72d24 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -20,7 +20,10 @@ jobs: 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 @@ -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/github-action-docker-image-exists@0.1.2 + 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 }}