5555 uses : docker/setup-buildx-action@v3
5656
5757 - name : Log in to the Container registry
58- if : github.event_name != 'pull_request' && ( github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging')
58+ if : github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
5959 uses : docker/login-action@v3
6060 with :
6161 registry : ghcr.io
6969 images : ${{ matrix.image }}
7070 tags : |
7171 type=raw,value=latest-${{ matrix.arch }},enable=${{ github.ref == 'refs/heads/main' }}
72- type=raw,value=staging-${{ matrix.arch }},enable=${{ github.ref == 'refs/heads/staging' }}
72+ type=raw,value=staging-${{ github.sha }}-${{ matrix.arch }},enable=${{ github.ref == 'refs/heads/staging' }}
7373 type=sha,format=long,suffix=-${{ matrix.arch }}
7474
7575 - name : Build and push Docker image
7878 context : .
7979 file : ${{ matrix.dockerfile }}
8080 platforms : ${{ matrix.platform }}
81- push : ${{ github.event_name != 'pull_request' && ( github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging') }}
81+ push : ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }}
8282 tags : ${{ steps.meta.outputs.tags }}
8383 labels : ${{ steps.meta.outputs.labels }}
8484 cache-from : type=gha,scope=build-v3
8989 create-manifests :
9090 runs-on : ubuntu-latest
9191 needs : build-and-push
92- if : github.event_name != 'pull_request' && ( github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging')
92+ if : github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
9393 strategy :
9494 matrix :
9595 include :
@@ -115,7 +115,6 @@ jobs:
115115 images : ${{ matrix.image }}
116116 tags : |
117117 type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
118- type=raw,value=staging,enable=${{ github.ref == 'refs/heads/staging' }}
119118 type=sha,format=long
120119
121120 - name : Create and push manifest
@@ -149,32 +148,4 @@ jobs:
149148 docker manifest inspect "$arm64_image" || echo "ARM64 image not found"
150149 exit 1
151150 fi
152- done
153-
154- trigger-infrastructure-deploy :
155- runs-on : ubuntu-latest
156- needs : create-manifests
157- if : github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main'
158- permissions :
159- contents : read
160-
161- steps :
162- - name : Trigger staging deployment
163- if : github.ref == 'refs/heads/staging'
164- run : |
165- curl -X POST \
166- -H "Accept: application/vnd.github.v3+json" \
167- -H "Authorization: token ${{ secrets.INFRA_DEPLOY_TOKEN }}" \
168- -H "X-GitHub-Api-Version: 2022-11-28" \
169- https://api.github.com/repos/${{ secrets.INFRA_REPO }}/dispatches \
170- -d '{"event_type":"staging-deploy","client_payload":{"sha":"${{ github.sha }}","ref":"${{ github.ref }}"}}'
171-
172- - name : Trigger production deployment
173- if : github.ref == 'refs/heads/main'
174- run : |
175- curl -X POST \
176- -H "Accept: application/vnd.github.v3+json" \
177- -H "Authorization: token ${{ secrets.INFRA_DEPLOY_TOKEN }}" \
178- -H "X-GitHub-Api-Version: 2022-11-28" \
179- https://api.github.com/repos/${{ secrets.INFRA_REPO }}/dispatches \
180- -d '{"event_type":"production-deploy","client_payload":{"sha":"${{ github.sha }}","ref":"${{ github.ref }}"}}'
151+ done
0 commit comments