summaryrefslogtreecommitdiff
path: root/.github/workflows/doxygen.yml
blob: bc6dfa6ab58901bb41ad07355ead02b1f930548e (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
57
58
59
name: Generate and Deploy Doxygen Documentation

on:
  push:
    branches:
      - master  # Replace with your default branch if different

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      # Step 1: Checkout the repository
      - name: Checkout Repository
        uses: actions/checkout@v3

      # Step 2: Install Doxygen
      - name: Install Doxygen
        run: sudo apt-get update && sudo apt-get install -y doxygen graphviz

      # Step 3: Generate Doxygen configuration
      - name: Generate Doxygen Config
        run: doxygen -g Doxyfile

      # Step 4: Configure Doxygen
        # Update Doxyfile to document only fbgl.h, use README.md as homepage, and set version
      - name: Update Doxyfile
        run: |
          sed -i 's/^PROJECT_NAME.*/PROJECT_NAME = "fbgl"/' Doxyfile
          sed -i 's/^PROJECT_NUMBER.*/PROJECT_NUMBER = 0.1.0/' Doxyfile
          sed -i 's/^OUTPUT_DIRECTORY.*/OUTPUT_DIRECTORY = docs/' Doxyfile
          sed -i 's/^INPUT.*/INPUT = fbgl.h README.md/' Doxyfile
          sed -i 's/^USE_MDFILE_AS_MAINPAGE.*/USE_MDFILE_AS_MAINPAGE = README.md/' Doxyfile
          sed -i 's/^FILE_PATTERNS.*/FILE_PATTERNS = fbgl.h README.md/' Doxyfile
          sed -i 's/^RECURSIVE.*/RECURSIVE = NO/' Doxyfile
          sed -i 's/^GENERATE_LATEX.*/GENERATE_LATEX = NO/' Doxyfile
          sed -i 's/^GENERATE_MAN.*/GENERATE_MAN = NO/' Doxyfile
          sed -i 's/^GENERATE_RTF.*/GENERATE_RTF = NO/' Doxyfile
          sed -i 's/^HTML_OUTPUT.*/HTML_OUTPUT = html/' Doxyfile
          sed -i 's/^QUIET.*/QUIET = YES/' Doxyfile

      # Step 5: Add Doxygen Awesome CSS for modern UI
      - name: Add Doxygen Awesome CSS
        run: |
          mkdir -p docs/html
          curl -o docs/html/doxygen-awesome.css https://raw.githubusercontent.com/jothepro/doxygen-awesome-css/main/doxygen-awesome.css
          echo 'HTML_EXTRA_STYLESHEET = docs/html/doxygen-awesome.css' >> Doxyfile

      # Step 6: Run Doxygen to generate the documentation
      - name: Run Doxygen
        run: doxygen Doxyfile

      # Step 7: Deploy to GitHub Pages
      - name: Deploy to GitHub Pages
        uses: peaceiris/actions-gh-pages@v4
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: docs/html
          publish_branch: gh-pages