-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (36 loc) · 1.33 KB
/
Copy pathdeploy.yml
File metadata and controls
44 lines (36 loc) · 1.33 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
name: Deploy Cloud Run Job
on:
push:
branches: [ "main" ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
# Authenticate with GCP using your service account JSON
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
# Install gcloud CLI
- name: Set up gcloud
uses: google-github-actions/setup-gcloud@v2
with:
project_id: f3data
- name: Configure Docker for Artifact Registry
run: gcloud auth configure-docker "us-central1-docker.pkg.dev"
- name: Build and push Docker image
run: |
IMAGE="us-central1-docker.pkg.dev/f3data/materialized-view-refresher/materialized-refresh-job"
docker build -t "$IMAGE:latest" .
docker push "$IMAGE:latest"
- name: Deploy Cloud Run Job
run: |
IMAGE="us-central1-docker.pkg.dev/f3data/materialized-view-refresher/materialized-refresh-job:latest"
gcloud run jobs deploy materialized-refresh-job \
--image "$IMAGE" \
--region "us-central1" \
--set-env-vars DB_HOST=35.239.19.124,DB_NAME=f3_prod,DB_USER=app_materializedviewrefresher \
--set-secrets DB_PASSWORD=app_materializedviewrefresher:latest \
--execute-now