Skip to content

Commit

Permalink
Only cache docker images on dev branch (esphome#6714)
Browse files Browse the repository at this point in the history
  • Loading branch information
jesserockz authored May 9, 2024
1 parent ca5050d commit 47a1710
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions .github/actions/build-image/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ runs:
echo $l >> $GITHUB_OUTPUT
done
# set cache-to only if dev branch
- id: cache-to
shell: bash
run: |-
if [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then
echo "value=type=gha,mode=max" >> $GITHUB_OUTPUT
else
echo "value=" >> $GITHUB_OUTPUT
fi
- name: Build and push to ghcr by digest
id: build-ghcr
uses: docker/[email protected]
Expand All @@ -43,7 +53,7 @@ runs:
platforms: ${{ inputs.platform }}
target: ${{ inputs.target }}
cache-from: type=gha
cache-to: type=gha,mode=max
cache-to: ${{ steps.cache-to.outputs.value }}
build-args: |
BASEIMGTYPE=${{ inputs.baseimg }}
BUILD_VERSION=${{ inputs.version }}
Expand All @@ -66,7 +76,7 @@ runs:
platforms: ${{ inputs.platform }}
target: ${{ inputs.target }}
cache-from: type=gha
cache-to: type=gha,mode=max
cache-to: ${{ steps.cache-to.outputs.value }}
build-args: |
BASEIMGTYPE=${{ inputs.baseimg }}
BUILD_VERSION=${{ inputs.version }}
Expand Down

0 comments on commit 47a1710

Please sign in to comment.