Run build on PR but don't push

This commit is contained in:
Leonard Jonathan Oh 2023-11-22 22:58:24 +00:00
parent 87c8befebe
commit 6025aa4b38

View file

@ -3,7 +3,10 @@ name: docker
on:
push:
tags:
- 'v2.*'
- '**'
pull_request:
branches:
- master
# This is needed to push to GitHub Container Registry. See https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry
permissions:
@ -28,9 +31,11 @@ jobs:
images: |
djmaze/snappymail
ghcr.io/${{ github.repository }}
# type=ref,event=pr generates tag(s) on PRs only. E.g. 'pr-123', 'pr-123-abc0123'
# type=ref,event=branch generates tag(s) on branch only. E.g. 'master', 'master-abc0123'
# type=ref,event=tag generates tag(s) on tags only. E.g. 'v0.0.0', 'v0.0.0-abc0123', and 'latest'
tags: |
type=ref,event=pr
type=ref,suffix=-{{sha}},event=pr
type=ref,event=branch
type=ref,event=tag
@ -101,7 +106,7 @@ jobs:
# TODO: Add more arches?
# platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/s390x
platforms: linux/386,linux/amd64
push: true
push: startsWith(github.ref, 'refs/tags/') # Push only on tags
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache