-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (43 loc) · 1.25 KB
/
azure-functions-app-nodejs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Build and deploy the function app to Azure
on:
workflow_dispatch:
permissions:
id-token: write
contents: read
env:
AZURE_FUNCTIONAPP_NAME: ${{ vars.AZURE_FUNCTIONAPP_NAME }}
WORKING_DIRECTORY: '.'
NODE_VERSION: '20.x'
jobs:
build-and-deploy:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.WORKING_DIRECTORY }}
environment: prod
steps:
- name: 'Checkout repo'
uses: actions/checkout@v4
- name: Azure Login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Setup Node ${{ env.NODE_VERSION }} Environment
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: 'Build project'
shell: bash
run: |
npm ci
npm run build
npm run test --if-present
npm prune --omit=dev # Removes packages specified in devDependencies
- name: 'Publish the package to the Azure function app'
uses: Azure/functions-action@v1
id: fa
with:
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
package: ${{ env.WORKING_DIRECTORY }}