name: publish
on:
  release:
    types: [published]
jobs:
  deploy:
    runs-on: ubuntu-20.04
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - name: install Doxygen 1.9.2
        run: |
          sudo apt-get update
          sudo apt-get install -y graphviz libclang-cpp1-9 libclang1-9
          wget https://www.doxygen.nl/files/doxygen-1.9.2.linux.bin.tar.gz
          tar -xvzf doxygen-1.9.2.linux.bin.tar.gz
          ln -s doxygen-1.9.2/bin/doxygen doxygen
      - name: set version
        run: echo "PROJECT_NUMBER = `git describe --tags`" >> Doxyfile
      - name: Generate Documentation
        run: ./doxygen Doxyfile
      - name: Publish generated content to GitHub Pages
        uses: tsunematsu21/actions-publish-gh-pages@v1.0.1
        with:
          dir: docs/html
          branch: gh-pages
          token: ${{ secrets.ACCESS_TOKEN }}