-
Notifications
You must be signed in to change notification settings - Fork 10
53 lines (45 loc) · 1.54 KB
/
main.yml
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
name: Staging Deploy to Google Cloud Functions
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: main
- name: Install DVC
run: |
sudo wget \
https://dvc.org/deb/dvc.list \
-O /etc/apt/sources.list.d/dvc.list &&
wget -qO - https://dvc.org/deb/iterative.asc | gpg --dearmor > packages.iterative.gpg &&
sudo install -o root -g root -m 644 packages.iterative.gpg /etc/apt/trusted.gpg.d/ &&
rm -f packages.iterative.gpg &&
sudo apt update &&
sudo apt install dvc
- name: Pull DVC Files
run: dvc pull
- name: Authenticate to Google Cloud
uses: "google-github-actions/auth@v1"
with:
credentials_json: ${{ secrets.GCP_SA_JSON }}
- name: Setup Google Cloud CLI
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
- name: Deploy to Cloud Functions
run: |
gcloud functions deploy getanswer-staging \
--gen2 \
--runtime=python310 \
--memory=4GB \
--region=us-east1 \
--timeout=300 \
--source=packages/googlecloud/functions/getanswer \
--entry-point=getanswer \
--trigger-http \
--allow-unauthenticated \
--set-env-vars OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY_STAGING }}