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 - utnotify-test
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 : ubuntu-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 : bash
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 : Zip artifact for deployment
41+ run : zip release.zip ./* -r
42+
43+ - name : Upload artifact for deployment job
44+ uses : actions/upload-artifact@v4
45+ with :
46+ name : node-app
47+ path : release.zip
48+
49+ deploy :
50+ runs-on : ubuntu-latest
51+ needs : build
52+ permissions :
53+ id-token : write # This is required for requesting the JWT
54+ contents : read # This is required for actions/checkout
55+
56+ steps :
57+ - name : Download artifact from build job
58+ uses : actions/download-artifact@v4
59+ with :
60+ name : node-app
61+
62+ - name : Unzip artifact for deployment
63+ run : unzip release.zip
64+
65+ - name : Login to Azure
66+ uses : azure/login@v2
67+ with :
68+ client-id : ${{ secrets.AZUREAPPSERVICE_CLIENTID_E212F5E16EFC4B29821901CFBE2F697C }}
69+ tenant-id : ${{ secrets.AZUREAPPSERVICE_TENANTID_52DBFD3F8D064B02AF429FA33913183C }}
70+ subscription-id : ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_4E537FA09AD74D6485FC407154981DA1 }}
71+
72+ - name : ' Run Azure Functions Action'
73+ uses : Azure/functions-action@v1
74+ id : fa
75+ with :
76+ app-name : ' utnotify-test'
77+ slot-name : ' Production'
78+ package : ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
79+
0 commit comments