Change: Updated to .NET 9 #25
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: 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 |