-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (35 loc) · 1.37 KB
/
cd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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 }}"'