Skip to content

Merge pull request #1 from RieBi/ci-cd #16

Merge pull request #1 from RieBi/ci-cd

Merge pull request #1 from RieBi/ci-cd #16

Workflow file for this run

name: DeployCountrie
on:
push:
branches: [ "master" ]
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
env:
ConnectionStrings__PostgreConnectionRelease: ${{ secrets.DATABASE_CONNECTION }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: 'Copy Dockerfile to root'
run: cp Web/Dockerfile ./Dockerfile
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- id: 'auth'
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
- name: 'Use gcloud CLI'
run: 'gcloud info'
- name: 'Build the docker image'
run: 'gcloud builds submit --tag europe-central2-docker.pkg.dev/countrie/repo/countrie:latest .'
- name: 'Deploy to Cloud Run'
run: 'gcloud run deploy countrie --image europe-central2-docker.pkg.dev/countrie/repo/countrie:latest --region europe-central2 --allow-unauthenticated --project countrie --max-instances=4 --update-env-vars=ConnectionStrings__PostgreConnectionRelease="${{ secrets.DATABASE_CONNECTION }}"'