[BACKEND] Deploy Cloud Run #23
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: "[BACKEND] Deploy Cloud Run" | |
on: | |
push: | |
branches: [main] | |
paths: | |
- backend/** | |
workflow_dispatch: | |
defaults: | |
run: | |
working-directory: backend | |
env: | |
SERVICE_NAME: kg1-backend | |
GCP_PROJECT: kg1-prod | |
GCP_PROJECT_ID: kg1-prod-405611 | |
GCP_REGION: europe-west1 | |
jobs: | |
deploy: | |
permissions: | |
contents: read | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup GCP Auth | |
uses: google-github-actions/auth@v1 | |
with: | |
export_environment_variables: true | |
project_id: ${{ env.GCP_PROJECT_ID }} | |
credentials_json: ${{ secrets.GCP_CREDENTIALS }} | |
- name: Setup GCP SDK | |
uses: google-github-actions/setup-gcloud@v1 | |
with: | |
version: latest | |
install_components: beta | |
project_id: ${{ env.GCP_PROJECT_ID }} | |
- name: Deploy Container to GCP | |
run: | | |
gcloud run deploy ${{ env.SERVICE_NAME }} \ | |
--source . \ | |
--project ${{ env.GCP_PROJECT }} \ | |
--region ${{ env.GCP_REGION }} \ | |
--set-env-vars OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} \ | |
--set-env-vars DATABASE_URL=${{ secrets.DATABASE_URL }} \ | |
--set-env-vars DATABASE_URL_DIRECT=${{ secrets.DATABASE_URL_DIRECT }} \ | |
--set-env-vars OPENAI_API_CALL_LIMIT=1000 \ | |
--set-env-vars NODE_COUNT_LIMIT=10000 |