-
Notifications
You must be signed in to change notification settings - Fork 0
128 lines (99 loc) · 3.19 KB
/
azfunction.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# Docs for the Azure Web Apps Deploy action: https://github.com/azure/functions-action
# More GitHub Actions for Azure: https://github.com/Azure/actions
name: Azure Function
on:
pull_request:
branches:
- main
push:
branches:
- main
workflow_dispatch:
env:
NODE_VERSION: "14.x"
permissions:
id-token: write
jobs:
test:
runs-on: ubuntu-20.04
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Node.js ${{ env.NODE_VERSION }}
uses: actions/[email protected]
with:
node-version: ${{ env.NODE_VERSION }}
- run: npm ci
- run: npm test
deploy-staging:
runs-on: ubuntu-20.04
needs:
- test
if: github.actor != 'dependabot[bot]'
environment:
name: Staging
url: https://github-automerge-staging.azurewebsites.net/api/health
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Node.js ${{ env.NODE_VERSION }}
uses: actions/[email protected]
with:
node-version: ${{ env.NODE_VERSION }}
- run: npm ci
- run: npm run build
- uses: azure/login@v1
with:
tenant-id: a26571f1-22b3-4756-ac7b-39ca684fab48
subscription-id: 108b3ddb-53fb-4344-80b2-d6c151912be6
client-id: 9153565b-2895-414b-8f22-f475b87befb7
- run: sudo npm install -g azure-functions-core-tools@3 --unsafe-perm=true
- name: func azure functionapp publish github-automerge --slot staging
run: func azure functionapp publish github-automerge --slot staging --typescript
healthcheck-staging:
needs: deploy-staging
runs-on: ubuntu-20.04
steps:
- name: Probe
uses: Jtalk/url-health-check-action@v3
with:
url: https://github-automerge-staging.azurewebsites.net/api/health
max-attempts: 5
retry-delay: 10s
follow-redirect: true
deploy-production:
runs-on: ubuntu-20.04
needs:
- healthcheck-staging
if: github.event_name == 'push'
environment:
name: Production
url: https://github-automerge-staging.azurewebsites.net/api/health
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Node.js ${{ env.NODE_VERSION }}
uses: actions/[email protected]
with:
node-version: ${{ env.NODE_VERSION }}
- run: npm ci
- run: npm run build
- uses: azure/[email protected]
with:
tenant-id: a26571f1-22b3-4756-ac7b-39ca684fab48
subscription-id: 108b3ddb-53fb-4344-80b2-d6c151912be6
client-id: 5d3f7698-1403-4c57-a377-1ea9dda502dc
- run: sudo npm install -g azure-functions-core-tools@3 --unsafe-perm=true
- name: func azure functionapp publish github-automerge
run: func azure functionapp publish github-automerge --typescript
healthcheck-production:
needs: deploy-production
runs-on: ubuntu-20.04
steps:
- name: Probe
uses: Jtalk/url-health-check-action@v3
with:
url: https://github-automerge.azurewebsites.net/api/health
max-attempts: 5
retry-delay: 10s
follow-redirect: true