Update deploy_backend.yml #190
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: Deploy backend | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
env: | |
PROJECT_ID: ${{ secrets.RUN_PROJECT }} | |
RUN_REGION: europe-north1 | |
SERVICE_NAME: medieteknik-api | |
jobs: | |
setup-build-deploy: | |
name: Setup, Build, and Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.8' | |
# Setup gcloud CLI | |
- id: 'auth' | |
uses: 'google-github-actions/auth@v1' | |
with: | |
credentials_json: ${{ secrets.RUN_SA_KEY }} | |
- uses: google-github-actions/setup-gcloud@v1 | |
with: | |
version: '363.0.0' | |
project_id: ${{ secrets.RUN_PROJECT }} | |
# Build and push image to Google Container Registry | |
- name: Build | |
run: |- | |
gcloud builds submit api \ | |
--quiet \ | |
--tag "gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA" | |
# Deploy image to Cloud Run | |
- name: Deploy | |
run: |- | |
gcloud run deploy "$SERVICE_NAME" \ | |
--quiet \ | |
--region "$RUN_REGION" \ | |
--image "gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA" \ | |
--platform "managed" \ | |
--allow-unauthenticated |