Skip to content

Commit

Permalink
Add script to build and deploy docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
karnkaul committed Jan 27, 2024
1 parent ab328d8 commit 37dcefd
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,7 @@ GENERATE_HTML = YES
# The default directory is: html.
# This tag requires that the tag GENERATE_HTML is set to YES.

HTML_OUTPUT = html
HTML_OUTPUT = docs

# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
# generated HTML page (for example: .htm, .php, .asp).
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ https://github.com/karnkaul/bave/assets/16272243/86539229-0640-42c5-baac-ca74eb3
- [x] Audio playback.
- [x] Streaming audio (music).

## API Reference

Documentation is located [here](https://karnkaul.github.io/bave-docs/).

## Requirements

### Runtime
Expand Down
68 changes: 68 additions & 0 deletions tools/build_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/bin/bash

script_path=${0%/*}
project_root=${script_path%/*}
commit=false
publish=false

while getopts "cp" arg; do
case $arg in
c) commit=true
;;
p) publish=true
;;
esac
done

if [[ ! $(doxygen --version) ]]; then
echo "ERROR: doxygen not found"
exit 1
fi

if [[ "$0" != "$project_root" ]] && [[ "$project_root" != "" ]]; then
cd "$project_root" || exit 1
echo "-- Changed pwd to $(pwd)"
fi

if [[ ! -d "out" ]]; then
echo "-- Creating out"
mkdir -p out
fi

cd out

if [[ ! -d "docs/.git" ]]; then
echo "-- Cloning bave-docs"
git clone https://github.com/karnkaul/bave-docs docs
else
echo "-- Checking out main"
cd docs
git switch main > /dev/null
git fetch && git reset --hard origin/main > /dev/null
fi

if [[ -d docs ]]; then
echo "-- Removing old docs"
rm -rf docs
fi

echo "-- Building docs"
cd ../..
doxygen -q
cd out/docs

if [[ ! -f .nojekyll ]]; then
echo "-- Creating .nojekyll"
touch .nojekyll
fi

if [[ $commit == true ]]; then
echo "-- Creating commit"
git add .
git commit -m "[Automated] Build docs."

if [[ $publish == true ]]; then
echo "-- Pushing to origin"
git push --force-with-lease
fi
fi

0 comments on commit 37dcefd

Please sign in to comment.