-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (40 loc) · 1.41 KB
/
main.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
49
50
51
52
name: Build and Push to GCR
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Restore dependencies
run: dotnet restore
- name: Build Container
run: dotnet publish /home/runner/work/mldas/mldas/MLDAS.Web/MLDAS.Web.csproj -r linux-x64 /t:PublishContainer -c Release
- name: Tag Container
run: docker tag mldas-web:latest us-central1-docker.pkg.dev/${{secrets.GCP_PROJECT_ID}}/mldas-web/mldas-web:latest
- name: Authenticate to GCP
uses: google-github-actions/auth@v2
with:
project_id: '${{ secrets.GCP_PROJECT_ID }}'
credentials_json: "${{ secrets.GCP_SERVICE_ACCOUNT_JSON }}"
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
- name: Configure Docker Auth
run: gcloud auth configure-docker us-central1-docker.pkg.dev
- name: Push Container to GCP
run: docker push us-central1-docker.pkg.dev/${{secrets.GCP_PROJECT_ID}}/mldas-web/mldas-web:latest
- name: Deploy to CLoud Run
uses: 'google-github-actions/deploy-cloudrun@v2'
with:
service: 'mldas'
image: us-central1-docker.pkg.dev/${{secrets.GCP_PROJECT_ID}}/mldas-web/mldas-web