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 - DevOps-Nextjs
5
+
6
+ on :
7
+ push :
8
+ branches :
9
+ - main
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 : ' 20.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_8880CE69A6614217B8FB3D194F0604D1 }}
61
+ tenant-id : ${{ secrets.AZUREAPPSERVICE_TENANTID_43C92120B1D1436BA7505900F99F4334 }}
62
+ subscription-id : ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_7B9ACCAD35EA4702B02792F93517F32A }}
63
+
64
+ - name : ' Deploy to Azure Web App'
65
+ id : deploy-to-webapp
66
+ uses : azure/webapps-deploy@v3
67
+ with :
68
+ app-name : ' DevOps-Nextjs'
69
+ slot-name : ' Production'
70
+ package : .
71
+
0 commit comments