fix: increasing the timeout on deploy step #5
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: Build and Deploy ML Model to Cloud Run | |
on: | |
push: | |
branches: | |
- prod | |
env: | |
PROJECT_ID: ${{ secrets.PROJECT_ID }} | |
RUN_REGION: us-central1 | |
SERVICE_NAME: creditsystem | |
jobs: | |
setup-build-deploy: | |
name: Setup, Build, and Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Authenticate with Google Cloud | |
uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} | |
- name: Set up gcloud | |
uses: google-github-actions/setup-gcloud@v2 | |
with: | |
project_id: ${{ env.PROJECT_ID }} | |
install_components: 'beta' | |
- name: Verify gcloud configuration | |
run: | | |
gcloud config list | |
gcloud info | |
- name: List files in the current directory (DEBUG) | |
run: | | |
ls -la | |
- name: Print Environment Variables (DEBUG) | |
run: | | |
echo "PROJECT_ID=${{ env.PROJECT_ID }}" | |
echo "SERVICE_NAME=${{ env.SERVICE_NAME }}" | |
echo "GITHUB_SHA=${GITHUB_SHA}" | |
- name: Submit build to Cloud Build | |
run: | | |
gcloud builds submit \ | |
--config cloudbuild.yaml \ | |
--substitutions="_IMAGE_TAG=gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA" | |
- name: Deploy to Cloud Run | |
run: |- | |
gcloud run deploy $SERVICE_NAME \ | |
--image "gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA" \ | |
--platform managed \ | |
--region "$RUN_REGION" \ | |
--allow-unauthenticated \ | |
--timeout=300s \ | |
--quiet \ |