GH pages via actions/deploy-pages #115
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
# 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 |