-
Notifications
You must be signed in to change notification settings - Fork 59
79 lines (66 loc) · 2.12 KB
/
build-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
72
73
74
75
76
77
78
79
name: Build/Deploy to Staging
on:
workflow_dispatch: # this makes the action manual
jobs:
build:
name: Install dependencies and generate static site
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- run: pip install nbconvert==7.0.0 packaging
- name: Convert Jupyter notebooks
run: |
shopt -s globstar
jupyter-nbconvert --to markdown **/*.ipynb --ExtractOutputPreprocessor.enabled=False
shopt -u globstar
shell: bash
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install vuepress
run: yarn global add vuepress
- name: Install package.json
run: yarn
- name: Build static site with vuepress
# alias for vuepress build src defined in package.json
run: yarn build
- name: Write commit SHA to gitcommit.txt in dist
shell: bash
run: |
echo $GITHUB_SHA > src/.vuepress/dist/gitcommit.txt
- name: Get size of files in dist
shell: bash
run: |
du -ah src/.vuepress/dist
- name: Archive build artifacts
uses: actions/upload-artifact@v2
with:
name: vuepress-dist
path: src/.vuepress/dist
deploy-staging:
name: Deploy to staging
runs-on: ubuntu-latest
environment:
name: staging
url: https://docs-staging.pupil-labs.com
needs: build
steps:
- uses: actions/checkout@v3
- name: Download generated website dist dir
uses: actions/download-artifact@v2
with:
name: vuepress-dist
path: src/.vuepress/dist
- name: Rsync action - Deploy to staging
uses: burnett01/[email protected]
with:
switches: -hrvz --delete --exclude=".htaccess"
path: src/.vuepress/dist/
remote_path: ${{ secrets.REMOTE_PATH }}
remote_host: ${{ secrets.REMOTE_HOST}}
remote_user: ${{ secrets.REMOTE_USER }}
remote_key: ${{ secrets.DEPLOY_KEY }}