Skip to content

Commit

Permalink
push the cache even if the build fails
Browse files Browse the repository at this point in the history
  • Loading branch information
bra-fsn committed Jan 29, 2025
1 parent e223649 commit 296a0bc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ jobs:
# we need to have two buildcache tags, but they conflict/race on the first build, so let's (re)build the amd64/arm64
# images from the cache and push their buildcaches individually
- name: Build and push amd64/arm64 Docker image
id: build-and-push
continue-on-error: true
uses: docker/build-push-action@v6
with:
context: ${{ github.workspace }}/images/${{ matrix.folder }}
Expand All @@ -66,6 +68,7 @@ jobs:
type=registry,ref=${{ env.REGISTRY }}/sparecores/${{ matrix.folder }}:buildcache-arm64
type=registry,ref=${{ env.REGISTRY }}/sparecores/${{ matrix.folder }}:buildcache-amd64
- name: Push amd64 Docker image's buildcache
if: always()
uses: docker/build-push-action@v6
with:
context: ${{ github.workspace }}/images/${{ matrix.folder }}
Expand All @@ -76,6 +79,7 @@ jobs:
cache-from: type=registry,ref=${{ env.REGISTRY }}/sparecores/${{ matrix.folder }}:buildcache-amd64
cache-to: type=registry,ref=${{ env.REGISTRY }}/sparecores/${{ matrix.folder }}:buildcache-amd64,mode=max
- name: Push arm64 Docker image's buildcache
if: always()
uses: docker/build-push-action@v6
with:
context: ${{ github.workspace }}/images/${{ matrix.folder }}
Expand All @@ -84,4 +88,7 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}-arm64
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/sparecores/${{ matrix.folder }}:buildcache-arm64
cache-to: type=registry,ref=${{ env.REGISTRY }}/sparecores/${{ matrix.folder }}:buildcache-arm64,mode=max
cache-to: type=registry,ref=${{ env.REGISTRY }}/sparecores/${{ matrix.folder }}:buildcache-arm64,mode=max
- name: Check build status
if: steps.build-and-push.outcome == 'failure'
run: exit 1

0 comments on commit 296a0bc

Please sign in to comment.