Skip to content

Commit e2a0d4e

Browse files
committed
ci: automate generating and deploying documentation
1 parent 1246e01 commit e2a0d4e

File tree

1 file changed

+70
-2
lines changed

1 file changed

+70
-2
lines changed

.github/workflows/CI.yml

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ jobs:
8181
path: |
8282
./node_modules/
8383
./build/
84-
key: "cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-ZMQ_VERSION:${{ matrix.zmq_version }}-Node:${{ matrix.node_version }}-${{ hashFiles('./package.json') }}"
84+
key: "cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-Node:${{ matrix.node_version }}-${{ hashFiles('./package.json') }}"
8585
restore-keys: |
86-
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-ZMQ_VERSION:${{ matrix.zmq_version }}-Node:${{ matrix.node_version }}-"
86+
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-Node:${{ matrix.node_version }}-"
8787
8888
- name: Setup Cpp
8989
if: ${{ !matrix.docker }}
@@ -160,3 +160,71 @@ jobs:
160160
run: |
161161
pnpm run clean
162162
pnpm run test
163+
164+
Docs:
165+
if: "startsWith(github.ref, 'refs/tags/') && !contains(github.event.head_commit.message, '[skip ci]')"
166+
runs-on: ubuntu-22.04
167+
strategy:
168+
fail-fast: false
169+
matrix:
170+
os:
171+
- ubuntu-22.04
172+
node_version:
173+
- 18
174+
node_arch:
175+
- x64
176+
cpp_arch:
177+
- x64
178+
ARCH:
179+
- x64
180+
zmq_draft:
181+
- false
182+
env:
183+
ZMQ_DRAFT: ${{ matrix.zmq_draft }}
184+
ZMQ_SHARED: false
185+
ARCH: ${{ matrix.ARCH }}
186+
187+
steps:
188+
- uses: actions/checkout@v3
189+
190+
- name: Cache
191+
uses: actions/cache@v3
192+
with:
193+
path: |
194+
./node_modules/
195+
./build/
196+
key: "cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-Node:${{ matrix.node_version }}-${{ hashFiles('./package.json') }}"
197+
restore-keys: |
198+
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-Node:${{ matrix.node_version }}-"
199+
200+
- name: Setup Cpp
201+
uses: aminya/setup-cpp@v1
202+
with:
203+
cmake: true
204+
architecture: ${{ matrix.cpp_arch }}
205+
206+
- uses: pnpm/[email protected]
207+
with:
208+
version: 7
209+
210+
- name: Install Node
211+
uses: actions/setup-node@v3
212+
with:
213+
node-version: ${{ matrix.node_version }}
214+
architecture: ${{ matrix.node_arch }}
215+
cache: "pnpm"
216+
217+
- name: Build Documentation
218+
if: "${{ contains(matrix.os, 'ubuntu') && !matrix.docker }}"
219+
run: |
220+
pnpm install
221+
pnpm run build.doc
222+
223+
- name: Deploy Documentation
224+
if: "${{ contains(matrix.os, 'ubuntu') && !matrix.docker }}"
225+
uses: Cecilapp/GitHub-Pages-deploy@v3
226+
with:
227+
build_dir: docs
228+
branch: gh-pages
229+
env:
230+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)