Skip to content

Commit

Permalink
ci: push docker images only on main or on forks
Browse files Browse the repository at this point in the history
  • Loading branch information
SamyDjemai committed Nov 12, 2024
1 parent d39e5d4 commit 90c34b6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:

env:
REGISTRY: ghcr.io
ORGANIZATION: singlestore-labs

permissions:
contents: read
Expand Down Expand Up @@ -73,15 +74,17 @@ jobs:
cache-from: type=gha,scope=${{ matrix.platform }}
cache-to: type=gha,scope=${{ matrix.platform }},mode=max
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
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 }}

- name: Export digest
if: github.ref == 'refs/heads/main' || github.repository_owner != env.ORGANIZATION
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
if: github.ref == 'refs/heads/main' || github.repository_owner != env.ORGANIZATION
uses: actions/upload-artifact@v4
with:
name: digests-${{ env.PLATFORM_PAIR }}
Expand All @@ -91,6 +94,7 @@ jobs:

merge:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || github.repository_owner != 'singlestore-labs'
needs:
- build
steps:
Expand All @@ -117,7 +121,6 @@ jobs:
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,format=long
Expand Down

0 comments on commit 90c34b6

Please sign in to comment.