-
Notifications
You must be signed in to change notification settings - Fork 2
76 lines (66 loc) · 2.72 KB
/
deploy-gcp.yml
File metadata and controls
76 lines (66 loc) · 2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Deploy SyncBot to GCP (Cloud Run). See docs/DEPLOYMENT.md and docs/INFRA_CONTRACT.md.
# To use AWS instead, disable this workflow and use deploy-aws.yml.
#
# Setup:
# 1. Run infra/gcp Terraform and configure Workload Identity Federation for GitHub.
# 2. Set GitHub vars: GCP_PROJECT_ID, GCP_REGION, GCP_WORKLOAD_IDENTITY_PROVIDER, GCP_SERVICE_ACCOUNT.
# 3. Set GitHub secrets for Slack/DB/encryption as needed for your CI (or use Secret Manager only).
# 4. This workflow intentionally fails until real build/deploy steps are configured.
name: Deploy (GCP)
on:
push:
branches:
- test
- prod
permissions:
id-token: write
contents: read
# Run only when DEPLOY_TARGET is set to 'gcp' (disable deploy-aws.yml if using GCP only)
jobs:
build-and-push:
if: vars.DEPLOY_TARGET == 'gcp'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
# Workload Identity Federation: authenticate without a key file
# - uses: google-github-actions/auth@v2
# with:
# workload_identity_provider: ${{ vars.GCP_WORKLOAD_IDENTITY_PROVIDER }}
# service_account: ${{ vars.GCP_SERVICE_ACCOUNT }}
# - uses: google-github-actions/setup-gcloud@v2
# Build and push container image to Artifact Registry
# - run: |
# gcloud builds submit --tag "${{ vars.GCP_REGION }}-docker.pkg.dev/${{ vars.GCP_PROJECT_ID }}/syncbot-TEST-images/syncbot:${{ github.sha }}" .
- name: Fail until GCP CI is configured
run: |
echo "GCP CI deploy is not configured in this repository."
echo "Implement WIF auth, image build/push, and deploy steps in deploy-gcp.yml before enabling DEPLOY_TARGET=gcp."
exit 1
deploy-test:
if: github.ref == 'refs/heads/test'
runs-on: ubuntu-latest
needs: build-and-push
# environment: test
steps:
# - uses: google-github-actions/auth@v2
# with:
# workload_identity_provider: ${{ vars.GCP_WORKLOAD_IDENTITY_PROVIDER }}
# service_account: ${{ vars.GCP_SERVICE_ACCOUNT }}
# - run: gcloud run deploy syncbot-test --image=... --region=...
- run: |
echo "deploy-test is blocked because GCP CI deploy is not configured."
exit 1
deploy-prod:
if: github.ref == 'refs/heads/prod'
runs-on: ubuntu-latest
needs: build-and-push
# environment: prod
steps:
# - uses: google-github-actions/auth@v2
# with:
# workload_identity_provider: ${{ vars.GCP_WORKLOAD_IDENTITY_PROVIDER }}
# service_account: ${{ vars.GCP_SERVICE_ACCOUNT }}
# - run: gcloud run deploy syncbot-prod --image=... --region=...
- run: |
echo "deploy-prod is blocked because GCP CI deploy is not configured."
exit 1