-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (36 loc) · 1.64 KB
/
publish.yaml
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
name: Publish
on:
workflow_dispatch:
push:
branches: [ master, main ]
env:
AZURE_WEBAPP_NAME: 'WebApiCICDWorkFlow' # set this to your application's name
AZURE_WEBAPP_PACKAGE_PATH: './publish_output' # set this to the path to your web app project, defaults to the repository root
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x.x
- name: Restore - Install dependencies
run: dotnet restore ./WebApiCICDWorkFlow.sln
- name: Build with dotnet
run: dotnet build ./WebApiCICDWorkFlow.sln --configuration Release --no-restore
- name: Test with dotnet
run: dotnet test ./WebApiCICDWorkFlow.Tests/WebApiCICDWorkFlow.Tests.csproj --configuration Release --verbosity normal
- name: Publish with dotnet
run: dotnet publish ./WebApiCICDWorkFlow.sln --configuration Release --no-build --output ${{env.AZURE_WEBAPP_PACKAGE_PATH}}
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: WebApiCICDWorkFlow_Production
path: ${{env.AZURE_WEBAPP_PACKAGE_PATH}}
- name: Deploy to Azure Web App
uses: azure/webapps-deploy@v3
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.AZURE_PUBLISH_PROFILE }}
package: ${{env.AZURE_WEBAPP_PACKAGE_PATH}}