Skip to content

Commit 6519add

Browse files
Williangalvanipatrickelectric
authored andcommitted
CI: create action for generating docs
1 parent fe1b57a commit 6519add

File tree

2 files changed

+38
-55
lines changed

2 files changed

+38
-55
lines changed

.github/workflows/docs.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Deploy Documentation to gh-pages
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
deploy-docs:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
with:
16+
submodules: recursive
17+
18+
- name: Setup Python (if required)
19+
uses: actions/setup-python@v2
20+
with:
21+
python-version: '3.x'
22+
23+
- name: Install dependencies
24+
run: sudo apt-get install doxygen graphviz
25+
26+
- name: Generate Documentation
27+
run: ci/deploy-gh-pages.sh
28+
29+
- name: Deploy to gh-pages
30+
uses: peaceiris/actions-gh-pages@v3
31+
with:
32+
github_token: ${{ secrets.GITHUB_TOKEN }}
33+
publish_dir: ./doc/html

ci/deploy-gh-pages.sh

Lines changed: 5 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,67 +2,17 @@
22

33
# Deploy repository documentation
44

5-
# Variables
6-
doc_path="doc"
7-
project_path=${doc_path}/..
8-
clone_folder=/tmp/update-repos
9-
10-
repository_name="ping-python"
11-
repository_githash=$(git -C ${project_path} rev-parse HEAD)
12-
13-
# Functions
145
source ci/ci-functions.sh
156

16-
echob "Check git configuration."
17-
if [ "${TRAVIS}" = "true" ] || ! git config --list | grep -q "user.name"; then
18-
# Config for auto-building
19-
echo "- Git configuration does not exist, a new one will be configured."
20-
git config --global user.email "support@bluerobotics.com"
21-
git config --global user.name "BlueRobotics-CI"
22-
else
23-
echo "- Git configuration already exist."
24-
fi
7+
doc_path="doc"
8+
9+
echob "generating message api..."
10+
test pip install jinja2
11+
test generate/generate-python.py --output-dir=brping
2512

2613
echob "Build doxygen documentation."
2714
test cd $doc_path
2815
test doxygen Doxyfile
2916

3017
echo "- Check files"
3118
ls -A "html/"
32-
33-
repo_path=${clone_folder}/${repository_name}
34-
echo "- Clone ${repository_name}"
35-
rm -rf ${repo_path}
36-
git clone https://${GITHUB_TOKEN}@github.com/bluerobotics/${repository_name} ${repo_path}
37-
echo "- Checkout gh-pages"
38-
git -C ${clone_folder}/${repository_name} checkout gh-pages
39-
40-
echob "Update gh-pages"
41-
mv html/* ${repo_path}
42-
43-
echo "- Check ${repository_name}"
44-
if [[ $(git -C ${repo_path} diff) ]]; then
45-
echo "- Something is different, a commit will be done."
46-
git -C ${repo_path} add --all
47-
COMMIT_MESSAGE="Update autogenerated files
48-
From https://github.com/bluerobotics/ping-protocol/tree/"$repository_githash
49-
git -C ${repo_path} commit -sm "${COMMIT_MESSAGE}"
50-
51-
echob "Check build type."
52-
# Do not build pull requests
53-
if [ ${TRAVIS_PULL_REQUEST} != "false" ]; then
54-
echo "- Do not deploy PRs."
55-
exit 0
56-
fi
57-
58-
echob "Check branch."
59-
# Do only build master branch
60-
if [ ${TRAVIS_BRANCH} != "master" ]; then
61-
echo "- Only master branch will be deployed."
62-
exit 0
63-
fi
64-
65-
git -C ${repo_path} push origin gh-pages
66-
else
67-
echo "- Ok."
68-
fi

0 commit comments

Comments
 (0)