-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (40 loc) · 1.17 KB
/
Copy pathdeploy.yml
File metadata and controls
49 lines (40 loc) · 1.17 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
name: Deploy to Cloud Run
on:
push:
branches: [deploy-github]
workflow_dispatch:
env:
PROJECT_ID: fullstackpro-python
REGION: us-central1
SERVICE: fastapi-hello
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # required for Workload Identity Federation
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GCP_WIF_PROVIDER }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
- name: Set up gcloud
uses: google-github-actions/setup-gcloud@v2
- name: Deploy to Cloud Run
run: |
gcloud run deploy "$SERVICE" \
--source . \
--project "$PROJECT_ID" \
--region "$REGION" \
--platform managed \
--allow-unauthenticated \
--quiet
- name: Show service URL
run: |
gcloud run services describe "$SERVICE" \
--project "$PROJECT_ID" \
--region "$REGION" \
--format="value(status.url)"