Skip to content

Commit a3c04d1

Browse files
author
Sara Gowen
committed
Add new workflow to deploy API to Azure Web App
1 parent 576df4d commit a3c04d1

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build and deploy Pocket DDD Server to Web App PocketDDDServerWebAPI2024
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
env:
8+
AZURE_WEBAPP_PACKAGE_PATH: PocketDDD.Server.WebAPI\publish
9+
CONFIGURATION: Release
10+
DOTNET_CORE_VERSION: 8.0.x
11+
WORKING_DIRECTORY: PocketDDD.Server.WebAPI
12+
13+
jobs:
14+
build:
15+
runs-on: windows-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Setup .NET SDK
19+
uses: actions/setup-dotnet@v3
20+
with:
21+
dotnet-version: ${{ env.DOTNET_CORE_VERSION }}
22+
- name: Restore
23+
run: dotnet restore "${{ env.WORKING_DIRECTORY }}"
24+
- name: Build
25+
run: dotnet build "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-restore
26+
- name: Test
27+
run: dotnet test "${{ env.WORKING_DIRECTORY }}" --no-build
28+
- name: Publish
29+
run: dotnet publish "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-build --output "${{ env.AZURE_WEBAPP_PACKAGE_PATH }}"
30+
- name: Publish Artifacts
31+
uses: actions/upload-artifact@v3
32+
with:
33+
name: webapp
34+
path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
35+
36+
deploy:
37+
runs-on: windows-latest
38+
needs: build
39+
steps:
40+
- name: Download artifact from build job
41+
uses: actions/download-artifact@v3
42+
with:
43+
name: webapp
44+
path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
45+
- name: Deploy to Azure WebApp
46+
uses: azure/webapps-deploy@v2
47+
with:
48+
app-name: ${{ secrets.AZURE_WEBAPP_NAME }}
49+
publish-profile: ${{ secrets.PocketDDDServerWebAPI2024_3A54 }}
50+
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}

0 commit comments

Comments
 (0)