Skip to content

Merge pull request #160 from loresoft/develop #161

Merge pull request #160 from loresoft/develop

Merge pull request #160 from loresoft/develop #161

Workflow file for this run

name: Build Project
env:
BUILD_PATH: '${{github.workspace}}/publish'
BUILD_VERSION: '1.8.${{github.run_number}}'
BUILD_INFORMATION: '1.8.${{github.run_number}}+Branch.${{github.ref_name}}.Sha.${{github.sha}}'
on:
push:
branches:
- master
- develop
pull_request:
branches:
- master
- develop
jobs:
build-project:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup .NET 7.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Setup MSBuild
uses: microsoft/[email protected]
- name: Restore Dependencies
run: dotnet restore ./service/InstructorIQ.sln
- name: Build Solution
run: 'dotnet build ./service/InstructorIQ.sln --no-restore --configuration Release -p:Version="${{env.BUILD_VERSION}}" -p:InformationalVersion="${{env.BUILD_INFORMATION}}"'
- 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-website:
runs-on: ubuntu-latest
needs: build-project
if: success() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop')
steps:
- name: Download Web Application Artifact
uses: actions/download-artifact@v3
with:
name: WebApplication
- name: Deploy Web Application to Azure Staging
if: github.ref == 'refs/heads/develop'
uses: azure/webapps-deploy@v2
with:
app-name: 'web-ls-app-eus-iq-stg-01'
slot-name: 'Production'
publish-profile: ${{secrets.PUBLISH_PROFILE_STAGING}}
package: ./
- name: Deploy Web Application to Azure Production
if: github.ref == 'refs/heads/master'
uses: azure/webapps-deploy@v2
with:
app-name: 'web-ls-app-eus-iq-prd-01'
slot-name: 'Production'
publish-profile: ${{secrets.PUBLISH_PROFILE_PRODUCTION}}
package: ./
deploy-database:
runs-on: windows-latest
needs: build-project
if: success() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop')
steps:
- name: Download Database Artifact
uses: actions/download-artifact@v3
with:
name: Database
- name: Deploy SQL Server Database to Azure Staging
if: github.ref == 'refs/heads/develop'
uses: azure/[email protected]
with:
connection-string: ${{secrets.AZURE_SQL_CONNECTION_STAGING}}
path: './InstructorIQ.dacpac'
action: 'publish'
- name: Deploy SQL Server Database to Azure Production
if: github.ref == 'refs/heads/master'
uses: azure/[email protected]
with:
connection-string: ${{secrets.AZURE_SQL_CONNECTION_PRODUCTION}}
path: './InstructorIQ.dacpac'
action: 'publish'