Skip to content

Commit a0b230f

Browse files
committed
feat: Add GitHub Actions workflow for deploying Sample API to Azure
1 parent be0201e commit a0b230f

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Deploy Sample API to Azure
2+
3+
on:
4+
push:
5+
branches: [master]
6+
paths:
7+
- "src/c-sharp/JakubKozera.OpenApiUi.Sample/**"
8+
workflow_dispatch:
9+
10+
env:
11+
AZURE_WEBAPP_NAME: openapi-ui
12+
AZURE_WEBAPP_PACKAGE_PATH: "./src/c-sharp/JakubKozera.OpenApiUi.Sample"
13+
DOTNET_VERSION: "10.0.x"
14+
15+
jobs:
16+
build-and-deploy:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Setup .NET
24+
uses: actions/setup-dotnet@v4
25+
with:
26+
dotnet-version: ${{ env.DOTNET_VERSION }}
27+
28+
- name: Restore dependencies
29+
run: dotnet restore ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/JakubKozera.OpenApiUi.Sample.csproj
30+
31+
- name: Build application
32+
run: dotnet build ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/JakubKozera.OpenApiUi.Sample.csproj --configuration Release --no-restore
33+
34+
- name: Publish application
35+
run: dotnet publish ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/JakubKozera.OpenApiUi.Sample.csproj --configuration Release --no-build --output ./publish
36+
37+
- name: Login to Azure
38+
uses: azure/login@v2
39+
with:
40+
creds: ${{ secrets.AZURE_CREDENTIALS }}
41+
42+
- name: Deploy to Azure Web App
43+
uses: azure/webapps-deploy@v3
44+
with:
45+
app-name: ${{ env.AZURE_WEBAPP_NAME }}
46+
package: ./publish

0 commit comments

Comments
 (0)