Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jcapellman committed Jun 26, 2024
2 parents 92701a3 + 2833210 commit 9cbf4fd
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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

0 comments on commit 9cbf4fd

Please sign in to comment.