Skip to content

Commit e336074

Browse files
committed
Add or update the Azure App Service build and deployment workflow config
1 parent deb50b7 commit e336074

1 file changed

Lines changed: 81 additions & 0 deletions

File tree

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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 - azure-nodejs-test-app
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: '22.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: |
64+
unzip release.zip
65+
rm release.zip
66+
67+
- name: Login to Azure
68+
uses: azure/login@v2
69+
with:
70+
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_CE8F46994EDE46ABAB69A0CFF61B9BA6 }}
71+
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_2DE3582E55504C03A3D8CED01A236AE7 }}
72+
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_A6C2565C9A2140DCA0B7415FF9EB2B68 }}
73+
74+
- name: 'Run Azure Functions Action'
75+
uses: Azure/functions-action@v1
76+
id: fa
77+
with:
78+
app-name: 'azure-nodejs-test-app'
79+
slot-name: 'Production'
80+
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
81+

0 commit comments

Comments
 (0)