-
Notifications
You must be signed in to change notification settings - Fork 12
75 lines (62 loc) · 1.87 KB
/
deploy.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
# To use this GitHub Actions for deploying the bot, please add a new secret "PUBLISH_PROFILE".
# This secret is the content of *.PublishSettings file downloaded from your Azure Web Apps.
name: Build and deploy Node.js app to Azure Web App
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Node.js version
uses: actions/setup-node@v1
with:
node-version: '12.13.0'
- run: npm ci
- run: npm run build --if-preset
- run: npm test --if-present
- run: npm pack
- run: tar xvf *.tgz
- name: Run zip -1rq ../zipdeploy.zip .
run: |
zip -1rq zipdeploy.zip node_modules
cd package
ls -laR
zip -1rq ../zipdeploy.zip .
- name: Upload artifact (tarball)
uses: actions/upload-artifact@v2
with:
name: package
path: '*.tgz'
- name: Upload artifact (Zip Deploy)
uses: actions/upload-artifact@v2
with:
name: package
path: zipdeploy.zip
deploy:
runs-on: ubuntu-latest
needs: build
if: ${{ startsWith(github.ref, 'refs/heads/') }}
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: package
- name: Deploy to Azure Web App
id: deploy
uses: azure/webapps-deploy@v2
with:
slot-name: production
publish-profile: ${{ secrets.PUBLISH_PROFILE }}
package: zipdeploy.zip
- name: Ping deployment
# We need to sleep because Azure Web Apps need time to pick up changes
run: |
sleep 5
curl -s ${{ steps.deploy.outputs.webapp-url }}/health.txt
curl -s ${{ steps.deploy.outputs.webapp-url }}/ready.txt