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 Node.js app to Azure Web App - Exercise-webapp-react
5+
6+ on :
7+ push :
8+ branches :
9+ - master
10+ workflow_dispatch :
11+
12+ jobs :
13+ build :
14+ runs-on : ubuntu-latest
15+
16+ steps :
17+ - uses : actions/checkout@v4
18+
19+ - name : Set up Node.js version
20+ uses : actions/setup-node@v3
21+ with :
22+ node-version : ' 18.x'
23+
24+ - name : npm install, build, and test
25+ run : |
26+ npm install
27+ npm run build --if-present
28+ npm run test --if-present
29+
30+ - name : Zip artifact for deployment
31+ run : zip release.zip ./* -r
32+
33+ - name : Upload artifact for deployment job
34+ uses : actions/upload-artifact@v4
35+ with :
36+ name : node-app
37+ path : release.zip
38+
39+ deploy :
40+ runs-on : ubuntu-latest
41+ needs : build
42+ environment :
43+ name : ' Production'
44+ url : ${{ steps.deploy-to-webapp.outputs.webapp-url }}
45+ permissions :
46+ id-token : write # This is required for requesting the JWT
47+
48+ steps :
49+ - name : Download artifact from build job
50+ uses : actions/download-artifact@v4
51+ with :
52+ name : node-app
53+
54+ - name : Unzip artifact for deployment
55+ run : unzip release.zip
56+
57+ - name : Login to Azure
58+ uses : azure/login@v2
59+ with :
60+ client-id : ${{ secrets.AZUREAPPSERVICE_CLIENTID_B0692CB01AF6438A820920F9570749CA }}
61+ tenant-id : ${{ secrets.AZUREAPPSERVICE_TENANTID_C9F6AEFC3334404EAFFA8EC0888849FF }}
62+ subscription-id : ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_7C606434F9EF4E888AB3ECA672E0C7C6 }}
63+
64+ - name : ' Deploy to Azure Web App'
65+ id : deploy-to-webapp
66+ uses : azure/webapps-deploy@v3
67+ with :
68+ app-name : ' Exercise-webapp-react'
69+ slot-name : ' Production'
70+ package : .
71+
0 commit comments