Skip to content

Commit 044ebc3

Browse files
committed
fix: improved doxygen pipeline
1 parent 3cc708c commit 044ebc3

File tree

1 file changed

+77
-32
lines changed

1 file changed

+77
-32
lines changed

.github/workflows/doxygen.yml

Lines changed: 77 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,81 @@ jobs:
1010
doxygen:
1111
runs-on: ubuntu-latest
1212

13+
env:
14+
DOC_BASE: build/doc/docs
15+
1316
steps:
14-
- name: Checkout repository
15-
uses: actions/checkout@v3
16-
17-
- name: Install Doxygen
18-
run: sudo apt-get install doxygen graphviz -y
19-
20-
- name: Generate Doxygen configuration and build it
21-
run: |
22-
TAG_NAME=$(echo $GITHUB_REF | sed 's/refs\/tags\///')
23-
mkdir -p build/doc/docs/$TAG_NAME && cd build && cmake -D BUILD_DOCUMENTATION=ON -D SKIP_CXX_BUILD=ON .. && make doc
24-
echo "Created folder for documentation:"
25-
ls doc/docs
26-
27-
- name: Move contents of html folder one level up
28-
run: |
29-
TAG_NAME=$(echo $GITHUB_REF | sed 's/refs\/tags\///')
30-
mv build/doc/docs/$TAG_NAME/html/* build/doc/docs/$TAG_NAME/
31-
32-
- name: Create index.html for redirect
33-
run: |
34-
TAG_NAME=$(echo $GITHUB_REF | sed 's/refs\/tags\///')
35-
URL="https://frankarobotics.github.io/libfranka/${TAG_NAME}/"
36-
echo $URL
37-
echo "<html><head><meta http-equiv=\"refresh\" content=\"0; url=$URL\"></head></html>" > build/doc/docs/index.html
38-
39-
- name: Deploy to GitHub Pages
40-
uses: peaceiris/actions-gh-pages@v3
41-
with:
42-
github_token: ${{ secrets.GITHUB_TOKEN }}
43-
publish_branch: gh-pages
44-
publish_dir: build/doc/docs
45-
keep_files: true
17+
- name: Checkout repository
18+
uses: actions/checkout@v3
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Install dependencies
23+
run: |
24+
set -e
25+
sudo apt-get update
26+
sudo apt-get install -y doxygen graphviz cmake
27+
28+
- name: Determine documentation tag
29+
id: doc_tag
30+
run: |
31+
set -e
32+
33+
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
34+
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
35+
else
36+
echo "TAG_NAME=latest" >> $GITHUB_OUTPUT
37+
fi
38+
39+
- name: Build documentation
40+
run: |
41+
set -e
42+
43+
TAG_NAME="${{ steps.doc_tag.outputs.TAG_NAME }}"
44+
DOC_DIR="${DOC_BASE}/$TAG_NAME"
45+
46+
echo "Using documentation tag: $TAG_NAME"
47+
48+
# Clean latest deployment if rebuilding latest
49+
if [[ "$TAG_NAME" == "latest" ]]; then
50+
rm -rf "$DOC_DIR"
51+
fi
52+
53+
mkdir -p "$DOC_DIR"
54+
55+
cd build || exit 1
56+
57+
cmake -D BUILD_DOCUMENTATION=ON -D SKIP_CXX_BUILD=ON ..
58+
make doc
59+
60+
- name: Normalize HTML structure
61+
run: |
62+
set -e
63+
64+
TAG_NAME="${{ steps.doc_tag.outputs.TAG_NAME }}"
65+
DOC_DIR="${DOC_BASE}/$TAG_NAME"
66+
SRC="${DOC_DIR}/html"
67+
68+
if [[ -d "$SRC" ]]; then
69+
mv "$SRC"/* "$DOC_DIR"/
70+
rm -rf "$SRC"
71+
else
72+
echo "HTML directory not found — skipping"
73+
fi
74+
75+
- name: Create redirect index
76+
run: |
77+
TAG_NAME="${{ steps.doc_tag.outputs.TAG_NAME }}"
78+
79+
URL="https://frankarobotics.github.io/libfranka/${TAG_NAME}/"
80+
81+
echo "<html><head><meta http-equiv=\"refresh\" content=\"0; url=$URL\"></head></html>" \
82+
> "${DOC_BASE}/index.html"
83+
84+
- name: Deploy to GitHub Pages
85+
uses: peaceiris/actions-gh-pages@v3
86+
with:
87+
github_token: ${{ secrets.GITHUB_TOKEN }}
88+
publish_branch: gh-pages
89+
publish_dir: ${{ env.DOC_BASE }}
90+
keep_files: true

0 commit comments

Comments
 (0)