-
Notifications
You must be signed in to change notification settings - Fork 70
52 lines (50 loc) · 1.48 KB
/
doxygen.yml
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
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