Merge pull request #67 from DataScience-GT/refactor/routes #12
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 Portal to Cloud Run | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'sites/portal/**' | |
| - 'packages/**' | |
| - 'sites/portal/Dockerfile' | |
| workflow_dispatch: | |
| env: | |
| PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} | |
| REGION: us-central1 | |
| SERVICE_NAME: portal | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Authenticate to Google Cloud | |
| uses: google-github-actions/auth@v2 | |
| with: | |
| credentials_json: ${{ secrets.GCP_SA_KEY }} | |
| - name: Set up Cloud SDK | |
| uses: google-github-actions/setup-gcloud@v2 | |
| with: | |
| project_id: ${{ env.PROJECT_ID }} | |
| - name: Configure Docker for GCR | |
| run: gcloud auth configure-docker --quiet | |
| - name: Build Docker image | |
| run: | | |
| docker build \ | |
| -t gcr.io/${{ env.PROJECT_ID }}/${{ env.SERVICE_NAME }}:${{ github.sha }} \ | |
| -t gcr.io/${{ env.PROJECT_ID }}/${{ env.SERVICE_NAME }}:latest \ | |
| -f sites/portal/Dockerfile . | |
| - name: Push to Container Registry | |
| run: | | |
| docker push gcr.io/${{ env.PROJECT_ID }}/${{ env.SERVICE_NAME }}:${{ github.sha }} | |
| docker push gcr.io/${{ env.PROJECT_ID }}/${{ env.SERVICE_NAME }}:latest | |
| - name: Deploy to Cloud Run | |
| run: | | |
| gcloud run deploy ${{ env.SERVICE_NAME }} \ | |
| --image gcr.io/${{ env.PROJECT_ID }}/${{ env.SERVICE_NAME }}:${{ github.sha }} \ | |
| --platform managed \ | |
| --region ${{ env.REGION }} \ | |
| --allow-unauthenticated \ | |
| --memory 1Gi \ | |
| --cpu 1 \ | |
| --min-instances 0 \ | |
| --max-instances 10 \ | |
| --port 8080 \ | |
| --timeout 60s | |
| - name: Get Service URL | |
| run: | | |
| URL=$(gcloud run services describe ${{ env.SERVICE_NAME }} \ | |
| --region ${{ env.REGION }} \ | |
| --format 'value(status.url)') | |
| echo "::notice::Deployed to $URL" |