element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Code Exchange
  • Technologies
  • More
Code Exchange
Forum GitHub: automate project documentation with DoxyGen, and publish online after pushing commits
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Code Exchange to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Locked Locked
  • Replies 13 replies
  • Subscribers 45 subscribers
  • Views 2108 views
  • Users 0 members are here
  • doxygen
  • yaml
  • github.io
  • github
  • teseo_c++
Related
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

GitHub: automate project documentation with DoxyGen, and publish online after pushing commits

Jan Cumps
Jan Cumps over 1 year ago

Moved to  GitHub: automate project documentation with DoxyGen, and publish online after pushing commits 

The title says it all. You can generate project documentation from the comments in the source files. I'm using doxygen for that. What I tried today (and succeeded in), is to make a GitHub action that:

  • kicks off a process on one of its job servers that automatically generates the documentation
  • kicks of a second process to deploy that on github.io

image

Prerequisite at this point, is that you know how to configure your project for doxygen. And that you know how to write good comments that make for good documentation. Here's a link to one of my ./Doxygen configuration files, if you need inspiration. Take care that you have such a file checked into your project's github repository.

Then create a new GitHub action. You can that by creating a .yaml file in the .github/workflow subdir of your project and push that, or you can open your GitHub repo online, and navigate to Actions -> wew workflow -> set up a workflow yourself. The latter option has the advantage that you get some code support and validation. I named my file .github/workflows/doxygen-gh-pages.yml.

I set up 3 actions, that all will run on GitHub hosted servers:

  1. checkout the code
  2. generate the documentation with a nice GitHub market place plugin.
  3. publish to github.io

Here's the full content

# Sample workflow for building and deploying a Doxygen site to GitHub Pages
name: Deploy Doxygen with GitHub Pages dependencies preinstalled

on:
  # Runs on pushes targeting the default branch
  push:
    branches: ["main"]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
  contents: read
  pages: write
  id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
  group: "pages"
  cancel-in-progress: false

jobs:
  # Build job
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Setup Pages
        uses: actions/configure-pages@v5
      - name: Run Doxygen
        uses: mattnotmitt/doxygen-action@v1.9.5
        with:
          # working-directory: '${{github.workspace}}/Kerbal/doxygen'
          doxyfile-path: 'Doxyfile'
      - name: Upload artifact
        uses: actions/upload-pages-artifact@v3
        with:
          path: doc_generated/html

  # Deployment job
  deploy:
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    needs: build
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4

The nice thing is that you don't have to store any credentials. They are dynamically generated by GitHub. As repository manager, you control what can be in that .yaml file. And you can thus control what is allowed, and what actions run.

Here is a part of the run logs:

Checkout and doxygen html documents generation

image

Then deploy to github.io:

image

I created this for my Pico GPS library. The documentation is online: https://jancumps.github.io/pico_gps_teseo_i2c/

Link to all posts. 

  • Cancel

Top Replies

  • Fred27
    Fred27 over 1 year ago +2
    My favourite use of a build pipeline was when I was the solo developer on a large project. Nobody told me I couldn't go the whole hog and use not just the CI part but the CD (Continuous Deployment) too…
  • shabaz
    shabaz over 1 year ago +1
    That's very helpful! Relevant to all projects. GitHub Actions is powerful, looking forward to using that more. And, it's impressive that all that capability is for free with GitHub, including the web…
  • Jan Cumps
    Jan Cumps over 1 year ago +1
    VSCode Github Actions extension shows run statuses, and allows triggering a runfrom the IDE
Parents
  • Jan Cumps
    Jan Cumps over 1 year ago

    my current setup:

    • dev and main branch can only be updated via pull requests
    • pull requests into both branches can't be accepted if the build Action fails.
      (I may reconsider this in the development branch. But a feature should work before you merge the feature branch to develop)
    • when a pull request to production succeeds, the doxygen create and publish Action is run.

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
Reply
  • Jan Cumps
    Jan Cumps over 1 year ago

    my current setup:

    • dev and main branch can only be updated via pull requests
    • pull requests into both branches can't be accepted if the build Action fails.
      (I may reconsider this in the development branch. But a feature should work before you merge the feature branch to develop)
    • when a pull request to production succeeds, the doxygen create and publish Action is run.

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube