Fix patch versioning to count the number of commits from last major minor #253
Workflow file for this run
This file contains 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: Doxygen | |
on: | |
push: | |
branches: ['main'] | |
pull_request: | |
branches: ['main'] | |
types: [opened, closed] | |
jobs: | |
update-doxygen: | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.merged == true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Switch to gh-pages branch | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
shell: bash | |
run: | | |
# Check if the gh-pages branch exists. If not, create it. | |
branch_exist=$(git ls-remote --heads origin gh-pages) | |
if [ -z ${branch_exist} ]; then | |
git checkout --orphan gh-pages | |
git reset --hard | |
git commit --allow-empty -m "Created gh-pages branch" | |
git push origin gh-pages | |
fi | |
# Switch to gh-pages branch | |
git fetch | |
git checkout gh-pages | |
- name: Create local changes | |
run: | | |
sudo apt-get install doxygen | |
cd docs | |
doxygen | |
cp -r ./html/* ./ | |
rm -rf ./html | |
git add . | |
- name: Commit and push files | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config --global user.name ${{ github.actor }} | |
git config --global user.email ${{ github.actor }}@users.noreply.github.com | |
git add . | |
# Only commit if doxygen is changed. | |
changed=$(git diff-index HEAD) | |
if [ -n "$changed" ]; then | |
git commit -m "Auto-generate Doxygen documentation via Github Actions" -a | |
git push origin gh-pages | |
fi |