Bump microsoft/setup-msbuild from 1.3 to 2 #215
Workflow file for this run
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 Project | |
env: | |
DOTNET_NOLOGO: true | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
DOTNET_ENVIRONMENT: github | |
ASPNETCORE_ENVIRONMENT: github | |
BUILD_PATH: "${{github.workspace}}/artifacts" | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
tags: | |
- "v*" | |
pull_request: | |
branches: | |
- master | |
- develop | |
jobs: | |
build-project: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
- name: Setup MSBuild | |
uses: microsoft/setup-msbuild@v2 | |
- name: Restore Dependencies | |
run: dotnet restore ./service/InstructorIQ.sln | |
- name: Build Solution | |
run: "dotnet build ./service/InstructorIQ.sln --no-restore --configuration Release" | |
- name: Publish Web Application | |
if: success() | |
run: 'dotnet publish ./service/src/InstructorIQ.WebApplication/InstructorIQ.WebApplication.csproj --no-build --configuration Release --output "${{env.BUILD_PATH}}/WebApplication"' | |
- name: Build Database | |
if: success() | |
run: 'msbuild ./database/InstructorIQ.sln /t:Build /p:Configuration=Release /p:OutputPath="${{env.BUILD_PATH}}/database"' | |
- name: Upload WebApplication Artifact | |
if: success() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: WebApplication | |
path: "${{env.BUILD_PATH}}/WebApplication" | |
- name: Upload Database Artifact | |
if: success() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Database | |
path: "${{env.BUILD_PATH}}/Database" | |
deploy-staging: | |
runs-on: ubuntu-latest | |
needs: build-project | |
if: success() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') | |
environment: | |
name: Staging | |
url: https://staging.instructoriq.com/ | |
steps: | |
- name: Download Database Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: Database | |
- name: Download Web Application Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: WebApplication | |
- name: Deploy SQL Server Database to Azure | |
if: success() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') | |
uses: azure/[email protected] | |
with: | |
connection-string: ${{secrets.AZURE_SQL_CONNECTION_STAGING}} | |
path: "./InstructorIQ.dacpac" | |
action: "publish" | |
- name: Deploy Web Application to Azure | |
if: success() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') | |
uses: azure/webapps-deploy@v3 | |
with: | |
app-name: "web-ls-app-eus-iq-stg-01" | |
slot-name: "Production" | |
publish-profile: ${{secrets.PUBLISH_PROFILE_STAGING}} | |
package: ./ | |
deploy-production: | |
runs-on: ubuntu-latest | |
needs: build-project | |
if: success() && github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v') | |
environment: | |
name: Production | |
url: https://instructoriq.com/ | |
steps: | |
- name: Download Database Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: Database | |
- name: Download Web Application Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: WebApplication | |
- name: Deploy SQL Server Database to Azure | |
if: success() && github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v') | |
uses: azure/[email protected] | |
with: | |
connection-string: ${{secrets.AZURE_SQL_CONNECTION_PRODUCTION}} | |
path: "./InstructorIQ.dacpac" | |
action: "publish" | |
- name: Deploy Web Application to Azure | |
if: success() && github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v') | |
uses: azure/webapps-deploy@v3 | |
with: | |
app-name: "web-ls-app-eus-iq-prd-01" | |
slot-name: "Production" | |
publish-profile: ${{secrets.PUBLISH_PROFILE_PRODUCTION}} | |
package: ./ |