Fix bug in parameter-values #72
This file contains hidden or 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: Deploy to GCP Cloud Run | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "src/**" | |
| - "terraform/**" | |
| - "Dockerfile" | |
| - "pyproject.toml" | |
| - "uv.lock" | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Setup Python | |
| run: uv python install 3.13 | |
| - name: Sync dependencies | |
| run: uv sync --extra dev | |
| - name: Run tests | |
| run: uv run pytest tests/test_models.py -v | |
| deploy: | |
| name: Deploy | |
| runs-on: ubuntu-latest | |
| needs: test | |
| environment: production | |
| env: | |
| IMAGE_URL: ${{ vars.GCP_REGION }}-docker.pkg.dev/${{ vars.GCP_PROJECT_ID }}/${{ vars.PROJECT_NAME }}/${{ vars.PROJECT_NAME }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Authenticate to Google Cloud | |
| uses: google-github-actions/auth@v2 | |
| with: | |
| workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} | |
| service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} | |
| - name: Set up Cloud SDK | |
| uses: google-github-actions/setup-gcloud@v2 | |
| - name: Configure Docker for Artifact Registry | |
| run: gcloud auth configure-docker ${{ vars.GCP_REGION }}-docker.pkg.dev | |
| - name: Build and push Docker image | |
| run: | | |
| docker build -t $IMAGE_URL:${{ github.sha }} . | |
| docker tag $IMAGE_URL:${{ github.sha }} $IMAGE_URL:latest | |
| docker push $IMAGE_URL:${{ github.sha }} | |
| docker push $IMAGE_URL:latest | |
| - name: Setup Terraform | |
| uses: hashicorp/setup-terraform@v3 | |
| with: | |
| terraform_version: 1.6.0 | |
| - name: Terraform init | |
| working-directory: ./terraform | |
| run: terraform init | |
| - name: Terraform apply | |
| working-directory: ./terraform | |
| env: | |
| TF_VAR_supabase_url: ${{ secrets.SUPABASE_URL }} | |
| TF_VAR_supabase_key: ${{ secrets.SUPABASE_KEY }} | |
| TF_VAR_supabase_db_url: ${{ secrets.SUPABASE_DB_URL }} | |
| TF_VAR_logfire_token: ${{ secrets.LOGFIRE_TOKEN }} | |
| TF_VAR_logfire_environment: prod | |
| run: terraform apply -auto-approve | |
| - name: Deploy API to Cloud Run | |
| run: | | |
| gcloud run services update ${{ vars.API_SERVICE_NAME }} \ | |
| --region=${{ vars.GCP_REGION }} \ | |
| --image=$IMAGE_URL:${{ github.sha }} | |
| - name: Deploy worker to Cloud Run | |
| run: | | |
| gcloud run services update ${{ vars.WORKER_SERVICE_NAME }} \ | |
| --region=${{ vars.GCP_REGION }} \ | |
| --image=$IMAGE_URL:${{ github.sha }} | |
| - name: Get API URL | |
| run: | | |
| API_URL=$(gcloud run services describe ${{ vars.API_SERVICE_NAME }} \ | |
| --region=${{ vars.GCP_REGION }} \ | |
| --format='value(status.url)') | |
| echo "API: $API_URL" | |
| echo "Health: $API_URL/health" | |
| echo "Docs: $API_URL/docs" |