-
Notifications
You must be signed in to change notification settings - Fork 1
79 lines (65 loc) · 2.16 KB
/
build-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
name: Build & Publish docs
on:
workflow_dispatch:
jobs:
build:
name: Build & Publish docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Build Docusaurus
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "16"
cache: "npm"
cache-dependency-path: "docs/package-lock.json"
- name: Cache docusaurus
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/docs/.docusaurus
key: |
${{ runner.os }}-docusaurus
restore-keys: |
${{ runner.os }}-docusaurus
- name: Install dependencies
run: |
npm ci --prefix docs
- name: Lint / Formatting
run: |
npm run typecheck --prefix docs
# TODO: should add more in the future if needed
- name: Build
run: |
npm run build --prefix docs
# Fetch API documentation
- uses: aica-technology/.github/.github/actions/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: aica-technology/.github/.github/actions/[email protected]
id: ensure-image
with:
image_name: aica-technology/backend-api-docs
- name: Get API version to fetch
id: api-version
run: |
VER="$(cat docs/api.version)"
echo "Version: $VER"
echo "version=$VER" >> $GITHUB_OUTPUT
- name: Create directory
run: |
mkdir -p docs/build/api
- name: Extract Swagger from the built image
uses: aica-technology/.github/.github/actions/[email protected]
with:
image: ${{ steps.ensure-image.outputs.image_name }}:${{ steps.api-version.outputs.version }}
source: /index.html
destination: docs/build/api/index.html
# Deploy to GitHub Pages
- name: Deploy
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref_name == 'main')
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/build