From 6519addc19777c98bac8ae4bfedf2c3d1f04d841 Mon Sep 17 00:00:00 2001 From: Willian Galvani Date: Tue, 5 Sep 2023 11:22:07 -0300 Subject: [PATCH] CI: create action for generating docs --- .github/workflows/docs.yml | 33 +++++++++++++++++++++ ci/deploy-gh-pages.sh | 60 ++++---------------------------------- 2 files changed, 38 insertions(+), 55 deletions(-) create mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000..3cd6a9c7 --- /dev/null +++ b/.github/workflows/docs.yml @@ -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 diff --git a/ci/deploy-gh-pages.sh b/ci/deploy-gh-pages.sh index 6ac9f0fe..1d11267a 100755 --- a/ci/deploy-gh-pages.sh +++ b/ci/deploy-gh-pages.sh @@ -2,26 +2,13 @@ # 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 "support@bluerobotics.com" - 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 @@ -29,40 +16,3 @@ 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