-
Notifications
You must be signed in to change notification settings - Fork 7
102 lines (88 loc) · 2.85 KB
/
publish.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: publish
# Trigger the workflow on pushes to master, or workflow dispatches from the master branch (checked later)
on:
push:
branches:
- master
workflow_dispatch:
# Set permissions on the github.token for gh-pages use
permissions:
contents: read
pages: write
id-token: write
# Enable publication to gh pages via actions/deploy-pages@v2
concurrency:
group: "pages"
cancel-in-progress: false
# Enable use of gh
env:
GH_TOKEN: ${{ github.token }}
jobs:
# Build the docs, saving the content to an artifact
build:
runs-on: ubuntu-latest
env:
build_api_docs: "ON"
python: "3.9"
steps:
# Checkout this repository into specified path
- name: Checkout this repository
uses: actions/checkout@v4
with:
path: FLAMEGPU2-docs
# If API docs are being built, check them out into a subfolder.
- name: Checkout FLAMEGPU2/FLAMEGPU2
if: env.build_api_docs == 'ON'
uses: actions/checkout@v4
with:
repository: FLAMEGPU/FLAMEGPU2
path: FLAMEGPU2
# Install dependencies via apt
- name: Install graphviz
run: sudo apt -y install graphviz
# Install API docs dependencies via apt
- name: Install doxygen
if: env.build_api_docs == 'ON'
run: sudo apt -y install doxygen
# Select the correct python version
- name: Select Python
if: ${{ env.python != '' }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.python }}
# Install python dependencies via pip into a venv
- name: Install python packages
working-directory: FLAMEGPU2-docs
run: |
mkdir -p -m 700 .venv
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -r requirements.txt
# Configure CMake
- name: Configure
working-directory: FLAMEGPU2-docs
run: |
source .venv/bin/activate
cmake . -B build -DFLAMEGPU_BUILD_API_DOCUMENTATION=${{ env.build_api_docs }}
# Build the documentation
- name: Build
working-directory: FLAMEGPU2-docs/build
run: cmake --build . --target all --verbose -j `nproc`
# Save HTML for later
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: FLAMEGPU2-docs/build/userguide/
# If this should deploy (push or workflow dispatch on master) to github pages, do so using the saved artifact
# This requires "GitHub Actions" selected in github.com/org/repo/settings/pages
deploy:
if: ${{ ( github.event_name == 'workflow_dispatch' || github.event_name == 'push' ) && github.ref == 'refs/heads/master' }}
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2