Skip to content

Commit 90c34b6

Browse files
committed
ci: push docker images only on main or on forks
1 parent d39e5d4 commit 90c34b6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

.github/workflows/docker-build.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313

1414
env:
1515
REGISTRY: ghcr.io
16+
ORGANIZATION: singlestore-labs
1617

1718
permissions:
1819
contents: read
@@ -73,15 +74,17 @@ jobs:
7374
cache-from: type=gha,scope=${{ matrix.platform }}
7475
cache-to: type=gha,scope=${{ matrix.platform }},mode=max
7576
labels: ${{ steps.meta.outputs.labels }}
76-
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
77+
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=${{ github.ref == 'refs/heads/main' || github.repository_owner != env.ORGANIZATION }}
7778

7879
- name: Export digest
80+
if: github.ref == 'refs/heads/main' || github.repository_owner != env.ORGANIZATION
7981
run: |
8082
mkdir -p /tmp/digests
8183
digest="${{ steps.build.outputs.digest }}"
8284
touch "/tmp/digests/${digest#sha256:}"
8385
8486
- name: Upload digest
87+
if: github.ref == 'refs/heads/main' || github.repository_owner != env.ORGANIZATION
8588
uses: actions/upload-artifact@v4
8689
with:
8790
name: digests-${{ env.PLATFORM_PAIR }}
@@ -91,6 +94,7 @@ jobs:
9194

9295
merge:
9396
runs-on: ubuntu-latest
97+
if: github.ref == 'refs/heads/main' || github.repository_owner != 'singlestore-labs'
9498
needs:
9599
- build
96100
steps:
@@ -117,7 +121,6 @@ jobs:
117121
type=raw,value=latest,enable={{is_default_branch}}
118122
type=ref,event=branch
119123
type=ref,event=tag
120-
type=ref,event=pr
121124
type=semver,pattern={{version}}
122125
type=semver,pattern={{major}}.{{minor}}
123126
type=sha,format=long

0 commit comments

Comments
 (0)