@@ -2,8 +2,7 @@ name: Build and Publish Docker Image
22
33on :
44 push :
5- branches : [main]
6- tags : ['v*']
5+ branches : [main, staging]
76
87jobs :
98 build-and-push :
5655 uses : docker/setup-buildx-action@v3
5756
5857 - name : Log in to the Container registry
59- if : github.event_name != 'pull_request'
58+ if : github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
6059 uses : docker/login-action@v3
6160 with :
6261 registry : ghcr.io
7069 images : ${{ matrix.image }}
7170 tags : |
7271 type=raw,value=latest-${{ matrix.arch }},enable=${{ github.ref == 'refs/heads/main' }}
73- type=ref,event=pr,suffix=-${{ matrix.arch }}
74- type=semver,pattern={{version}},suffix=-${{ matrix.arch }}
75- type=semver,pattern={{major}}.{{minor}},suffix=-${{ matrix.arch }}
76- type=semver,pattern={{major}}.{{minor}}.{{patch}},suffix=-${{ matrix.arch }}
72+ type=raw,value=staging-${{ github.sha }}-${{ matrix.arch }},enable=${{ github.ref == 'refs/heads/staging' }}
7773 type=sha,format=long,suffix=-${{ matrix.arch }}
7874
7975 - name : Build and push Docker image
8278 context : .
8379 file : ${{ matrix.dockerfile }}
8480 platforms : ${{ matrix.platform }}
85- push : ${{ github.event_name != 'pull_request' }}
81+ push : ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }}
8682 tags : ${{ steps.meta.outputs.tags }}
8783 labels : ${{ steps.meta.outputs.labels }}
8884 cache-from : type=gha,scope=build-v3
9389 create-manifests :
9490 runs-on : ubuntu-latest
9591 needs : build-and-push
96- if : github.event_name != 'pull_request'
92+ if : github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
9793 strategy :
9894 matrix :
9995 include :
@@ -119,10 +115,6 @@ jobs:
119115 images : ${{ matrix.image }}
120116 tags : |
121117 type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
122- type=ref,event=pr
123- type=semver,pattern={{version}}
124- type=semver,pattern={{major}}.{{minor}}
125- type=semver,pattern={{major}}.{{minor}}.{{patch}}
126118 type=sha,format=long
127119
128120 - name : Create and push manifest
0 commit comments