summaryrefslogtreecommitdiff
path: root/.github/workflows/docs.yml
blob: 41a7ceace220d6a3baa35f97b1fc459a7c4a38b2 (plain)
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
name: Generate Doxygen Documentation

on:
  push:
    branches: [ master ]
  workflow_dispatch:

permissions:
  contents: write
  pages: write
  id-token: write

jobs:
  generate-docs:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Install Doxygen and Graphviz
        run: |
          sudo apt-get update
          sudo apt-get install -y doxygen graphviz

      - name: Clone Doxygen Awesome Theme
        run: |
          git clone https://github.com/jothepro/doxygen-awesome-css.git doxygen-awesome

      - name: Create and Configure Doxyfile
        run: |
          doxygen -g Doxyfile
          
          # Customize Doxyfile settings with proper sed escaping
          sed -i 's/PROJECT_NAME *=.*$/PROJECT_NAME = "fbgl"/g' Doxyfile
          sed -i 's/PROJECT_NUMBER *=.*$/PROJECT_NUMBER = 0.1.0/g' Doxyfile
          sed -i 's/OUTPUT_DIRECTORY *=.*$/OUTPUT_DIRECTORY = docs/g' Doxyfile
          sed -i 's/INPUT *=.*$/INPUT = fbgl.h README.md/g' Doxyfile
          sed -i 's/HTML_OUTPUT *=.*$/HTML_OUTPUT = .\/public\/docs\/html/g' Doxyfile
          
          # Set homepage to README.md
          echo "USE_MDFILE_AS_MAINPAGE = README.md" >> Doxyfile
          
          # Configure Doxygen Awesome theme with dark mode
          echo "HTML_EXTRA_STYLESHEET = doxygen-awesome/doxygen-awesome.css doxygen-awesome/doxygen-awesome-dark-mode.css" >> Doxyfile
          echo "HTML_COLORSTYLE = DARK" >> Doxyfile

      - name: Generate Documentation
        run: doxygen Doxyfile

      - name: Deploy to GitHub Pages
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_branch: gh-pages
          publish_dir: ./public/docs/html
          force_orphan: true