Skip to content

Commit 4737e6e

Browse files
AchoArnoldCopilot
andcommitted
ci: add deploy job to trigger Cloud Build after integration tests
Add a deploy job that authenticates to GCP via Workload Identity Federation and triggers the api-httpsms-com Cloud Build trigger with the tested commit SHA. Only runs on push to main after integration tests pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 65f7552 commit 4737e6e

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

.github/workflows/api.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010

1111
permissions:
1212
contents: read
13+
id-token: write
1314

1415
jobs:
1516
integration-test:
@@ -71,3 +72,24 @@ jobs:
7172
if: always()
7273
working-directory: ./tests
7374
run: docker compose down -v
75+
76+
deploy:
77+
runs-on: ubuntu-latest
78+
needs: integration-test
79+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
80+
steps:
81+
- name: Authenticate to Google Cloud 🔐
82+
uses: google-github-actions/auth@v2
83+
with:
84+
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
85+
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
86+
87+
- name: Set up Cloud SDK ☁️
88+
uses: google-github-actions/setup-gcloud@v2
89+
90+
- name: Trigger Cloud Build Deploy 🚀
91+
run: |
92+
gcloud builds triggers run api-httpsms-com \
93+
--region=global \
94+
--project=httpsms-86c51 \
95+
--sha=${{ github.sha }}

0 commit comments

Comments
 (0)