Skip to content

Merge pull request #167 from lAnubisl/dependabot/nuget/Microsoft.Visu… #119

Merge pull request #167 from lAnubisl/dependabot/nuget/Microsoft.Visu…

Merge pull request #167 from lAnubisl/dependabot/nuget/Microsoft.Visu… #119

Workflow file for this run

name: 'Build and Publish'
on:
push:
branches: [ "master" ]
workflow_dispatch:
env:
DOTNET_VERSION: '6.0.x' # set this to the dotnet version to use
jobs:
build:
name: 'Build'
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v3
- name: 'Setup DotNet ${{ env.DOTNET_VERSION }} Environment'
uses: actions/setup-dotnet@v2
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: 'Run Unit Tests'
run: |
dotnet test --configuration Release --logger "trx;LogFileName=test-results.trx" || true
- name: Test Report
uses: dorny/test-reporter@v1
if: always()
with:
name: DotNET Tests
path: "**/test-results.trx"
reporter: dotnet-trx
fail-on-error: true
- name: 'Publish'
shell: bash
run: |
dotnet build LostFilmMonitoring.AzureFunction/LostFilmMonitoring.AzureFunction.csproj --configuration Release --output publish
- name: 'Store artifact'
uses: actions/upload-artifact@v3
with:
name: azure-functionapp
path: |
publish
if-no-files-found: error
retention-days: 5
deploy_to_staging:
name: 'Deploy to Staging'
runs-on: ubuntu-latest
needs: 'build'
if: ${{ github.ref_name == 'master' || github.ref_name == 'release' }}
environment: 'Staging'
steps:
- name: 'Download artifact'
uses: actions/download-artifact@v3
with:
name: azure-functionapp
path: packageDir
- name: 'Deploy'
uses: Azure/functions-action@v1
with:
app-name: '${{ secrets.AZURE_FUNCTION_APP_NAME }}'
slot-name: 'Production'
package: packageDir
publish-profile: ${{ secrets.AZURE_FUNCTION_PUBLISH_PROFILE }}
deploy_to_Production:
name: 'Deploy to Production'
runs-on: ubuntu-latest
needs: 'deploy_to_staging'
if: ${{ github.ref_name == 'master' || github.ref_name == 'release' }}
environment: 'Production'
steps:
- name: 'Download artifact'
uses: actions/download-artifact@v3
with:
name: azure-functionapp
path: packageDir
- name: 'Deploy'
uses: Azure/functions-action@v1
with:
app-name: '${{ secrets.AZURE_FUNCTION_APP_NAME }}'
slot-name: 'Production'
package: packageDir
publish-profile: ${{ secrets.AZURE_FUNCTION_PUBLISH_PROFILE }}