Skip to content

Commit 401677e

Browse files
committed
Add or update the Azure App Service build and deployment workflow config
1 parent 83d1d5a commit 401677e

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed
+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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 - atp-garaj
5+
6+
on:
7+
push:
8+
branches:
9+
- master
10+
workflow_dispatch:
11+
12+
jobs:
13+
build:
14+
runs-on: windows-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up .NET Core
20+
uses: actions/setup-dotnet@v4
21+
with:
22+
dotnet-version: '8.x'
23+
24+
- name: Build with dotnet
25+
run: dotnet build --configuration Release
26+
27+
- name: dotnet publish
28+
run: dotnet publish -c Release -o "${{env.DOTNET_ROOT}}/myapp"
29+
30+
- name: Upload artifact for deployment job
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: .net-app
34+
path: ${{env.DOTNET_ROOT}}/myapp
35+
36+
deploy:
37+
runs-on: windows-latest
38+
needs: build
39+
environment:
40+
name: 'Production'
41+
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
42+
permissions:
43+
id-token: write #This is required for requesting the JWT
44+
45+
steps:
46+
- name: Download artifact from build job
47+
uses: actions/download-artifact@v4
48+
with:
49+
name: .net-app
50+
51+
- name: Login to Azure
52+
uses: azure/login@v2
53+
with:
54+
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_279F79A3A14745E19F51BFF7917E4B2D }}
55+
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_E60C40B70B324D0DB04BC5600FF11804 }}
56+
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_D88C36E96A8740BB8F8121A45BF9CD0F }}
57+
58+
- name: Deploy to Azure Web App
59+
id: deploy-to-webapp
60+
uses: azure/webapps-deploy@v3
61+
with:
62+
app-name: 'atp-garaj'
63+
slot-name: 'Production'
64+
package: .
65+

0 commit comments

Comments
 (0)