Skip to content

Deploy API Docs

Deploy API Docs #1611

name: Deploy API Docs
on:
schedule:
# UTC timezone
- cron: '0 6 * * *'
workflow_dispatch:
jobs:
build:
name: 'Build API Docs (${{ matrix.gazebo_distribution }})'
runs-on: ubuntu-latest
container:
image: ubuntu:${{ matrix.ubuntu_distribution }}
strategy:
fail-fast: false
matrix:
include:
- ubuntu_distribution: focal
gazebo_distribution: citadel
- ubuntu_distribution: focal
gazebo_distribution: fortress
- ubuntu_distribution: focal
gazebo_distribution: garden
- ubuntu_distribution: jammy
gazebo_distribution: harmonic
- ubuntu_distribution: noble
gazebo_distribution: ionic
steps:
- uses: ros-tooling/[email protected]
- name: 'Set up Gazebo'
uses: gazebo-tooling/setup-gazebo@1f55cec330de851fa373f1ade8ac6b7ddfe6f013
with:
required-gazebo-distributions: ${{ matrix.gazebo_distribution }}
use-gazebo-nightly: ${{ matrix.gazebo_distribution == 'ionic'}}
- name: 'Add Doxygen'
run: sudo apt-get install -y doxygen graphviz texlive-latex-extra
- name: 'Add missing dependencies'
run: sudo apt-get install -y libopengl-dev
- name: 'Build Docs'
run: |
mkdir -p ws/src
cd ws/src
vcs import --input https://raw.githubusercontent.com/gazebo-tooling/gazebodistro/master/collection-${{ matrix.gazebo_distribution}}.yaml
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install $(sort -u $(find . -iname 'packages-'${{ matrix.ubuntu_distribution}}'.apt' -o -iname 'packages.apt' | grep -v '/\.git/') | tr '\n' ' ')
cd ..
colcon build --merge-install --event-handlers console_cohesion+ --cmake-args -DBUILD_DOCS=ON -DBUILD_TESTING=OFF --cmake-target doc
- uses: actions/upload-artifact@v4
if: always()
with:
name: api-docs-${{ matrix.gazebo_distribution }}
path: ws/build/**/doxygen/html
if-no-files-found: 'error'
include-hidden-files: 'true'
upload:
name: Upload docs to production
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
# Allow only one concurrent deployment between this and the deploy workflow.
concurrency:
group: pages
cancel-in-progress: false
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
id: download
with:
path: .api-docs
pattern: api-docs-*
merge-multiple: true
- name: 'Restructure API Docs'
run: python3 tools/restructure_doxygen_artifacts.py ${{steps.download.outputs.download-path}} .api-out
- uses: actions/upload-artifact@v4
with:
name: api-docs
path: .api-out/*
if-no-files-found: 'error'
include-hidden-files: 'true'
- name: Commit
# The workflow upto this point is good for generating a preview,
# but only commit to deploy if we are on the master branch (not a pull request).
if: github.ref == 'refs/heads/master'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./.api-out
destination_dir: api
keep_files: true