-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI: create action for generating docs
- Loading branch information
1 parent
fe1b57a
commit 6519add
Showing
2 changed files
with
38 additions
and
55 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Deploy Documentation to gh-pages | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
deploy-docs: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Setup Python (if required) | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install dependencies | ||
run: sudo apt-get install doxygen graphviz | ||
|
||
- name: Generate Documentation | ||
run: ci/deploy-gh-pages.sh | ||
|
||
- name: Deploy to gh-pages | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./doc/html |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,67 +2,17 @@ | |
|
||
# Deploy repository documentation | ||
|
||
# Variables | ||
doc_path="doc" | ||
project_path=${doc_path}/.. | ||
clone_folder=/tmp/update-repos | ||
|
||
repository_name="ping-python" | ||
repository_githash=$(git -C ${project_path} rev-parse HEAD) | ||
|
||
# Functions | ||
source ci/ci-functions.sh | ||
|
||
echob "Check git configuration." | ||
if [ "${TRAVIS}" = "true" ] || ! git config --list | grep -q "user.name"; then | ||
# Config for auto-building | ||
echo "- Git configuration does not exist, a new one will be configured." | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "BlueRobotics-CI" | ||
else | ||
echo "- Git configuration already exist." | ||
fi | ||
doc_path="doc" | ||
|
||
echob "generating message api..." | ||
test pip install jinja2 | ||
test generate/generate-python.py --output-dir=brping | ||
|
||
echob "Build doxygen documentation." | ||
test cd $doc_path | ||
test doxygen Doxyfile | ||
|
||
echo "- Check files" | ||
ls -A "html/" | ||
|
||
repo_path=${clone_folder}/${repository_name} | ||
echo "- Clone ${repository_name}" | ||
rm -rf ${repo_path} | ||
git clone https://${GITHUB_TOKEN}@github.com/bluerobotics/${repository_name} ${repo_path} | ||
echo "- Checkout gh-pages" | ||
git -C ${clone_folder}/${repository_name} checkout gh-pages | ||
|
||
echob "Update gh-pages" | ||
mv html/* ${repo_path} | ||
|
||
echo "- Check ${repository_name}" | ||
if [[ $(git -C ${repo_path} diff) ]]; then | ||
echo "- Something is different, a commit will be done." | ||
git -C ${repo_path} add --all | ||
COMMIT_MESSAGE="Update autogenerated files | ||
From https://github.com/bluerobotics/ping-protocol/tree/"$repository_githash | ||
git -C ${repo_path} commit -sm "${COMMIT_MESSAGE}" | ||
|
||
echob "Check build type." | ||
# Do not build pull requests | ||
if [ ${TRAVIS_PULL_REQUEST} != "false" ]; then | ||
echo "- Do not deploy PRs." | ||
exit 0 | ||
fi | ||
|
||
echob "Check branch." | ||
# Do only build master branch | ||
if [ ${TRAVIS_BRANCH} != "master" ]; then | ||
echo "- Only master branch will be deployed." | ||
exit 0 | ||
fi | ||
|
||
git -C ${repo_path} push origin gh-pages | ||
else | ||
echo "- Ok." | ||
fi |