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