Deploy API Docs #1945
  
    
      This file contains hidden or 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: 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: fortress | |
| - ubuntu_distribution: jammy | |
| gazebo_distribution: harmonic | |
| - ubuntu_distribution: noble | |
| gazebo_distribution: ionic | |
| - ubuntu_distribution: noble | |
| gazebo_distribution: jetty | |
| steps: | |
| - uses: ros-tooling/[email protected] | |
| - name: 'Set up Gazebo' | |
| uses: gazebo-tooling/[email protected] | |
| with: | |
| required-gazebo-distributions: ${{ matrix.gazebo_distribution }} | |
| use-gazebo-prerelease: ${{ matrix.gazebo_distribution == 'jetty'}} | |
| - 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: false | |
| - run: python3 tools/restructure_doxygen_artifacts.py --input ${{steps.download.outputs.download-path}} .api-out | |
| - name: Deduplicate files | |
| run: | | |
| sudo apt-get install -y rdfind symlinks | |
| bash tools/deduplicate_files.sh .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: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| folder: ./.api-out | |
| target-folder: api | |
| clean: false |