Merge pull request #103 from eye-on-surveillance/AI/yt-previews #105
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |