1+ #  Docs for the Azure Web Apps Deploy action: https://github.com/azure/functions-action
2+ #  More GitHub Actions for Azure: https://github.com/Azure/actions
3+ 
4+ name : Build and deploy Node.js project to Azure Function App - xmcl-core-api 
5+ 
6+ on :
7+   push :
8+     branches :
9+       - main 
10+   workflow_dispatch :
11+ 
12+ env :
13+   AZURE_FUNCTIONAPP_PACKAGE_PATH : ' .' #  set this to the path to your web app project, defaults to the repository root
14+   NODE_VERSION : ' 20.x' #  set this to the node version to use (supports 8.x, 10.x, 12.x)
15+ 
16+ jobs :
17+   build :
18+     runs-on : windows-latest 
19+     permissions :
20+       contents : read  # This is required for actions/checkout
21+       
22+     steps :
23+       - name : ' Checkout GitHub Action' 
24+         uses : actions/checkout@v4 
25+ 
26+       - name : Setup Node ${{ env.NODE_VERSION }} Environment 
27+         uses : actions/setup-node@v3 
28+         with :
29+           node-version : ${{ env.NODE_VERSION }} 
30+ 
31+       - name : ' Resolve Project Dependencies Using Npm' 
32+         shell : pwsh 
33+         run : | 
34+           pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}' 
35+           npm install 
36+           npm run build --if-present 
37+           npm run test --if-present 
38+           popd 
39+ 
40+ name : Upload artifact for deployment job 
41+         uses : actions/upload-artifact@v4 
42+         with :
43+           name : node-app 
44+           path : . 
45+ 
46+   deploy :
47+     runs-on : windows-latest 
48+     needs : build 
49+     permissions :
50+       id-token : write  # This is required for requesting the JWT
51+       contents : read  # This is required for actions/checkout
52+ 
53+     steps :
54+       - name : Download artifact from build job 
55+         uses : actions/download-artifact@v4 
56+         with :
57+           name : node-app 
58+       
59+       - name : Login to Azure 
60+         uses : azure/login@v2 
61+         with :
62+           client-id : ${{ secrets.AZUREAPPSERVICE_CLIENTID_6AE2A68C882B404899639A55D62EF4DD }} 
63+           tenant-id : ${{ secrets.AZUREAPPSERVICE_TENANTID_FBBD2041BFF8473FAB1AE3C92DF1CD54 }} 
64+           subscription-id : ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_C61BBBA102A04788B37A30925845D84F }} 
65+ 
66+       - name : ' Run Azure Functions Action' 
67+         uses : Azure/functions-action@v1 
68+         id : fa 
69+         with :
70+           app-name : ' xmcl-core-api' 
71+           slot-name : ' Production' 
72+           package : ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} 
73+           
0 commit comments