-
Notifications
You must be signed in to change notification settings - Fork 9
81 lines (78 loc) · 2.66 KB
/
deploy_docs.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
name: Deploy API Document on GitHub Pages
on:
workflow_dispatch:
push:
branches:
# 現状過去バージョンのブランチでは GitHub Actions が有効になっておらず、また過去バージョンを更新することは事実上ほとんどないという理由により、
# main ブランチへの push 契機ですべてのバージョンを更新するように意図している。
# 万が一過去バージョンのみの更新が発生した場合は workflow_dispatch を手動で実行すること。
- main
env:
NODE_VERSION: '16'
PUBLIC_DIR: public
V3_REF: main
V2_REF: v2-main
V1_REF: v1-main
V3_DIR: v3
V2_DIR: v2
V1_DIR: v1
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Setup Node ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Checkout (v3)
uses: actions/checkout@v3
with:
ref: ${{ env.V3_REF }}
path: ${{ env.V3_DIR }}
- name: Checkout (v2)
uses: actions/checkout@v3
with:
ref: ${{ env.V2_REF }}
path: ${{ env.V2_DIR }}
- name: Checkout (v1)
uses: actions/checkout@v3
with:
ref: ${{ env.V1_REF }}
path: ${{ env.V1_DIR }}
- name: Install and Build (v3)
working-directory: ${{ env.V3_DIR }}
run: |
npm ci
npm run doc
- name: Install and Build (v2)
working-directory: ${{ env.V2_DIR }}
run: |
npm ci
npm run doc
- name: Install and Build (v1)
working-directory: ${{ env.V1_DIR }}
run: |
npm install
npm run doc
- name: Copy API docs
run: |
mkdir -p ${{ env.PUBLIC_DIR }}
cp -r ${{ env.V3_DIR }}/doc/html/ ${{ env.PUBLIC_DIR }}/${{ env.V3_DIR }}/
cp -r ${{ env.V2_DIR }}/doc/html/ ${{ env.PUBLIC_DIR }}/${{ env.V2_DIR }}/
cp -r ${{ env.V1_DIR }}/doc/html/ ${{ env.PUBLIC_DIR }}/${{ env.V1_DIR }}/
- name: Check API docs
run: |
for dir in ${{ env.V1_DIR }} ${{ env.V2_DIR }} ${{ env.V3_DIR }}
do
if [ ! -e ${{ env.PUBLIC_DIR }}/${dir}/index.html ]; then
echo "'${{ env.PUBLIC_DIR }}/${dir}/index.html' not found."
exit 1;
fi
done
- name: Deploy on gh-pages branch
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{ env.PUBLIC_DIR }}
user_name: 'github-actions'
user_email: '41898282+github-actions[bot]@users.noreply.github.com'