-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/jcapellman/mldas
- Loading branch information
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
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
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 |