Skip to content

Commit

Permalink
chore: Use cache-from to control ghcr cache
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Dec 20, 2023
1 parent 239bb96 commit df56d5a
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/ghcr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,12 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Determine whether to use cache
id: check-cache
run: echo "::set-output name=use_cache::$(if [ '${{ github.event_name }}' == 'workflow_dispatch' ] || [ '${{ github.event_name }}' == 'schedule' ]; then echo 'false'; else echo 'true'; fi)"

- name: Build and push Docker image
uses: docker/build-push-action@fdf7f43ecf7c1a5c7afe936410233728a8c2d9c2
with:
context: .
cache-from: ${{ github.event_name != 'schedule' && 'type=gha' || '' }}
cache-from: ${{ ( github.event_name != 'schedule' || github.event_name != 'workflow_dispatch' ) && 'type=gha' || '' }}
cache-to: type=gha,mode=max
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
no-cache: ${{ steps.check-cache.outputs.use_cache }}

0 comments on commit df56d5a

Please sign in to comment.