Skip to content

Commit 5c076ae

Browse files
committed
fix(ci): don't push image within PRs
1 parent b877a04 commit 5c076ae

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

.github/workflows/docker-publish.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,18 @@ name: Docker
77

88
on:
99
push:
10-
branches: [ "main" ]
10+
branches: ["main"]
1111
pull_request:
12-
branches: [ "main" ]
12+
branches: ["main"]
1313

1414
env:
1515
# Use docker.io for Docker Hub if empty
1616
REGISTRY: ghcr.io
1717
# github.repository as <account>/<repo>
1818
IMAGE_NAME: ${{ github.repository }}
1919

20-
2120
jobs:
2221
build:
23-
2422
runs-on: ubuntu-latest
2523
permissions:
2624
contents: read
@@ -39,8 +37,7 @@ jobs:
3937
if: github.event_name != 'pull_request'
4038
uses: sigstore/cosign-installer@f3c664df7af409cb4873aa5068053ba9d61a57b6 #v2.6.0
4139
with:
42-
cosign-release: 'v1.13.1'
43-
40+
cosign-release: "v1.13.1"
4441

4542
# Workaround: https://github.com/docker/build-push-action/issues/461
4643
- name: Setup Docker buildx
@@ -69,6 +66,7 @@ jobs:
6966
# Build and push Docker image with Buildx (don't push on PR)
7067
# https://github.com/docker/build-push-action
7168
- name: Build and push Docker image
69+
if: github.event_name != 'pull_request'
7270
id: build-and-push
7371
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
7472
with:
@@ -79,7 +77,6 @@ jobs:
7977
cache-from: type=gha
8078
cache-to: type=gha,mode=max
8179

82-
8380
# Sign the resulting Docker image digest except on PRs.
8481
# This will only write to the public Rekor transparency log when the Docker
8582
# repository is public to avoid leaking data. If you would like to publish

0 commit comments

Comments
 (0)