-
Notifications
You must be signed in to change notification settings - Fork 1
77 lines (62 loc) · 2.23 KB
/
web-api-cicd.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Web API CI/CD Workflow
on:
push:
branches:
- "NA"
env:
WEB_API_PROJECT_PATH: "./web/api"
jobs:
# pass data to reusable workflow
configuration:
name: "Configuration"
uses: ./.github/workflows/config.yml
buildWebApi:
name: "Build Web API"
needs: [configuration]
runs-on: ubuntu-latest
steps:
# checkout the repo
- name: "Checkout Repo"
uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ fromJson(needs.configuration.outputs.variables).functionRuntimeVersion }}.0.x
- name: Restore dependencies
working-directory: ${{ env.WEB_API_PROJECT_PATH }}
run: dotnet restore
- name: Build
working-directory: ${{ env.WEB_API_PROJECT_PATH }}
run: dotnet build --no-restore
# - name: Test
# run: dotnet test --no-build --verbosity normal
- name: Publish
working-directory: ${{ env.WEB_API_PROJECT_PATH }}
run: dotnet publish ./api/api.csproj -c Release -o webapi
- name: Upload a Build Artifact
uses: actions/upload-artifact@v3
with:
name: webapi
path: ${{ env.WEB_API_PROJECT_PATH }}/webapi/**
if-no-files-found: error
deployWebApi:
name: "Deploy Web API"
needs: [configuration, buildWebApi]
runs-on: ubuntu-latest
steps:
- name: Download a Build Artifact
uses: actions/download-artifact@v4.1.7
with:
name: webapi
path: webapi
- name: Login via Azure CLI
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_SP_CREDENTIALS }}
- name: Deploy web app
id: deploywebapp
uses: azure/webapps-deploy@v2
with:
app-name: ${{ fromJson(needs.configuration.outputs.variables).apiAppServiceName }}
# slot-name: staging
package: webapi