-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (51 loc) · 1.72 KB
/
build-deploy-workflow.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Deploy DotNet project to Azure Function App
on:
push:
branches: [ main ]
paths-ignore:
- '**/README.md'
- '**/*.yml'
workflow_dispatch:
env:
AZURE_FUNCTIONAPP_NAME: 'func-mtam-emu-staging' # set this to your function app name on Azure
DOTNET_VERSION: '8.0.x' # set this to the dotnet version to use (e.g. '2.1.x', '3.1.x', '5.0.x')
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: 'Dotnet restore, build & test'
run: |
dotnet restore
dotnet build --no-restore
dotnet test --no-build --verbosity normal
working-directory: ./
- name: Dotnet build and publish Function App with configuration 'Release'
run: |
dotnet build --configuration 'Release'
dotnet publish -c 'Release' --no-restore -o './published-app'
working-directory: MtamFunction
- name: Upload artifact 'mtam-function'
uses: actions/upload-artifact@v4
with:
name: mtam-function
path: MtamFunction/published-app
include-hidden-files: true
deploy:
runs-on: ubuntu-latest
needs: [ build ]
steps:
- name: 'Download artifact for staging'
uses: actions/download-artifact@v4
with:
name: mtam-function
path: './downloaded-app'
- name: 'Deploy artifact to staging'
uses: azure/functions-action@v1
with:
app-name: ${{env.AZURE_FUNCTIONAPP_NAME}}
package: './downloaded-app'
publish-profile: ${{secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE}}