diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index ded48e7..e7777af 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -55,7 +55,7 @@ jobs: set -euo pipefail owner="${GITHUB_REPOSITORY_OWNER,,}" - image="ghcr.io/${owner}/markdownbrain" + image="ghcr.io/${owner}/mdbrain" tags=() if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then @@ -82,6 +82,7 @@ jobs: } >> "$GITHUB_OUTPUT" - name: Build (and push) + if: ${{ github.event_name != 'pull_request' }} uses: docker/build-push-action@v6 with: context: . @@ -92,5 +93,18 @@ jobs: labels: | org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }} org.opencontainers.image.revision=${{ github.sha }} - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: type=registry,ref=${{ steps.meta.outputs.image }}:buildcache + cache-to: type=registry,ref=${{ steps.meta.outputs.image }}:buildcache,mode=max + + - name: Build (PR) + if: ${{ github.event_name == 'pull_request' }} + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile + platforms: ${{ steps.platforms.outputs.platforms }} + push: false + tags: ${{ steps.meta.outputs.tags }} + labels: | + org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }} + org.opencontainers.image.revision=${{ github.sha }}