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 to Azure App Services
5+
6+ on :
7+ push :
8+ branches :
9+ - master
10+ schedule :
11+ - cron : " 0 0/3 * * *"
12+
13+ jobs :
14+ build-and-deploy-dotnet-app :
15+ runs-on : ubuntu-latest
16+
17+ permissions :
18+ id-token : write
19+
20+ steps :
21+ - uses : actions/checkout@v4
22+
23+ - name : Modify the sample app
24+ run : |
25+ cp -r ./__tests__/dotnetsampleapp dotnetapp
26+ current_utc_time=$(date -u +"%Y-%m-%d %H:%M:%S %Z")
27+ sed -i "s/<<<net-place-holder>>>/$current_utc_time/g" dotnetapp/Controllers/HelloController.cs
28+
29+ echo "The placeholder has been replaced with current UTC time: $current_utc_time"
30+
31+ - name : Set up .NET Core
32+ uses : actions/setup-dotnet@v4
33+ with :
34+ dotnet-version : ' 8.x'
35+
36+ - name : Build with dotnet
37+ run : dotnet build --configuration Release dotnetapp/DOTNET_8_APP.csproj
38+
39+ - name : dotnet publish
40+ run : dotnet publish dotnetapp/DOTNET_8_APP.csproj -c Release -o myapp
41+
42+ - name : Upload artifact for deployment job
43+ uses : actions/upload-artifact@v4
44+ with :
45+ name : .net-app
46+ path : myapp
47+
48+ - name : Login to Azure
49+ uses : azure/login@v2
50+ with :
51+ client-id : ${{ secrets.AZUREAPPSERVICE_CLIENTID_DOTNETAPP1 }}
52+ tenant-id : ${{ secrets.AZUREAPPSERVICE_TENANTID }}
53+ subscription-id : ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID }}
54+
55+ - name : Deploy to Azure Web App
56+ id : deploy-to-webapp
57+ uses : azure/webapps-deploy@v3
58+ with :
59+ app-name : ' lwasv2-euap-dotnet-githubactionstest'
60+ slot-name : ' Production'
61+ package : myapp
62+
63+ build-and-deploy-node-app :
64+ runs-on : ubuntu-latest
65+
66+ permissions :
67+ id-token : write
68+
69+ steps :
70+ - uses : actions/checkout@v4
71+
72+ - name : modify Node.js App
73+ run : |
74+ cp -r ./__tests__/nodesampleapp nodeapp
75+ current_utc_time=$(date -u +"%Y-%m-%d %H:%M:%S %Z")
76+ sed -i "s/<<<node-place-holder>>>/$current_utc_time/g" nodeapp/server.js
77+
78+ echo "The placeholder has been replaced with current UTC time: $current_utc_time"
79+
80+ - name : Set up Node.js version
81+ uses : actions/setup-node@v3
82+ with :
83+ node-version : ' 18.x'
84+
85+ - name : npm install, build, and test
86+ run : |
87+ cd nodeapp
88+ npm install
89+ npm run build --if-present
90+ npm run test --if-present
91+
92+ - name : Upload artifact for deployment job
93+ uses : actions/upload-artifact@v4
94+ with :
95+ name : node-app
96+ path : nodeapp
97+
98+ - name : Login to Azure
99+ uses : azure/login@v2
100+ with :
101+ client-id : ${{ secrets.AZUREAPPSERVICE_CLIENTID_NODEAPP1 }}
102+ tenant-id : ${{ secrets.AZUREAPPSERVICE_TENANTID }}
103+ subscription-id : ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID }}
104+
105+ - name : ' Deploy to Azure Web App'
106+ id : deploy-to-webapp
107+ uses : azure/webapps-deploy@v3
108+ with :
109+ app-name : ' lwasv2-euap-node-githubactions'
110+ slot-name : ' Production'
111+ package : nodeapp
0 commit comments