-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (61 loc) · 1.99 KB
/
deploy-staging.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Deploy Azure Function App to Dev
on:
workflow_dispatch:
push:
branches:
- 'main'
env:
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.'
NODE_VERSION: '18.x'
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
build-and-deploy:
runs-on: ubuntu-latest
environment:
name: staging
url: ${{ steps.fa.outputs.app-url }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node ${{ env.NODE_VERSION }} Environment
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: npm install, build, and test
shell: bash
env:
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
WEBHOOK_SECRET: ${{ secrets.WEBHOOK_SECRET }}
APP_ID: ${{ vars.APP_ID }}
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
npm install
npm run build --if-present
npm run test --if-present
popd
- name: 'Run Azure Functions Action'
uses: Azure/functions-action@v1
id: fa
with:
app-name: ${{ vars.AZURE_FUNCTIONAPP_NAME }}
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }}
configure:
runs-on: ubuntu-latest
environment:
name: staging
steps:
- name: 'Az CLI login'
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Configure Azure Functions Environment
run: |
az functionapp config appsettings set --name ${{ vars.AZURE_FUNCTIONAPP_NAME }}-staging --resource-group ${{ vars.AZURE_RESOURCE_GROUP }} --settings \
"WEBHOOK_SECRET=${{ secrets.WEBHOOK_SECRET }}" \
"PRIVATE_KEY=${{ secrets.PRIVATE_KEY }}" \
"APP_ID=${{ vars.APP_ID }}"