Skip to content

Commit a04234b

Browse files
committed
Add or update the Azure App Service build and deployment workflow config
1 parent c225c74 commit a04234b

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
2+
# More GitHub Actions for Azure: https://github.com/Azure/actions
3+
4+
name: Build and deploy ASP.Net Core app to Azure Web App - admin-hub-api
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
jobs:
13+
build:
14+
runs-on: windows-latest
15+
permissions:
16+
contents: read #This is required for actions/checkout
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up .NET Core
22+
uses: actions/setup-dotnet@v4
23+
with:
24+
dotnet-version: '9.x'
25+
26+
- name: Build with dotnet
27+
run: dotnet build --configuration Release
28+
29+
- name: dotnet publish
30+
run: dotnet publish -c Release -o "${{env.DOTNET_ROOT}}/myapp"
31+
32+
- name: Upload artifact for deployment job
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: .net-app
36+
path: ${{env.DOTNET_ROOT}}/myapp
37+
38+
deploy:
39+
runs-on: windows-latest
40+
needs: build
41+
42+
permissions:
43+
id-token: write #This is required for requesting the JWT
44+
contents: read #This is required for actions/checkout
45+
46+
steps:
47+
- name: Download artifact from build job
48+
uses: actions/download-artifact@v4
49+
with:
50+
name: .net-app
51+
52+
- name: Login to Azure
53+
uses: azure/login@v2
54+
with:
55+
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_A4151A17B46646DD9EE92E0A47E4872F }}
56+
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_DF11F3AE9D8F45EC8CB5BF531F4DEC22 }}
57+
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_B5CE41383DB04033B4A8AA3AA81CE1AB }}
58+
59+
- name: Deploy to Azure Web App
60+
id: deploy-to-webapp
61+
uses: azure/webapps-deploy@v3
62+
with:
63+
app-name: 'admin-hub-api'
64+
slot-name: 'Production'
65+
package: .
66+

0 commit comments

Comments
 (0)