Fix list #14
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
# Workflow for deploying documentation to GitHub Pages | |
# WARNING: Make sure that code that is not meant to be public is not included in the ./docs folder. | |
# This workflow will make the content of the ./docs folder public. | |
name: ci | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
container: | |
image: ubmdriverless/f1tenth:latest | |
credentials: | |
username: ubmdriverless | |
password: ${{ secrets.DOCKER_HUB_TOKEN_READ_ONLY }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup ssh | |
uses: webfactory/ssh-agent@v0.9.0 | |
with: | |
ssh-private-key: ${{ secrets.PRIVATE_SSH_KEY }} | |
- name: Clone private repo | |
run: | | |
ssh-keyscan -H github.com >> /root/.ssh/known_hosts | |
git clone git@github.com:ubm-driverless/ubm-f1tenth.git | |
- name: Generate docs | |
run: | | |
set -e | |
echo "pwd: $(pwd)" | |
echo "ls: $(ls)" | |
# Paths | |
CPP_DOCS_DIR="./docs/cpp_packages" | |
PYTHON_DOCS_DIR="./docs/python_packages" | |
mkdir -p "$CPP_DOCS_DIR" "$PYTHON_DOCS_DIR" | |
MARKDOWN_FILE="./docs/CPP_PACKAGES.md" | |
# Building docs for C++ packages | |
echo "Building docs of C++ packages..." | |
source /home/ubm/rosdoc2/bin/activate | |
source /opt/ros/foxy/setup.bash | |
echo "# C++ Packages" > "$MARKDOWN_FILE" | |
echo "" >> "$MARKDOWN_FILE" | |
for f in $(find ./ubm-f1tenth -type f -iname "package.xml"); do | |
package_dir="${f%/package.xml}"; | |
package_name="${package_dir##*/}" | |
package_markdown="$CPP_DOCS_DIR/$package_name.md" | |
package_doc_path="$CPP_DOCS_DIR/$package_name/index.html" | |
if grep -q "rosdoc2" "$f"; then | |
echo "Building $package_name with rosdoc2" | |
rosdoc2 build -p "$package_dir" -o "$CPP_DOCS_DIR/" > /dev/null 2>&1 | |
if [ -f "$package_doc_path" ]; then | |
echo "- [$package_name](cpp_packages/$package_name.md)" >> "$MARKDOWN_FILE" | |
echo "<html><head><meta http-equiv='refresh' content='0; url=./$package_name/index.html' /></head></html>" > "$package_markdown" | |
fi | |
fi | |
done | |
deactivate | |
# Note: by using the following code, python documentation will be built 2 times. (now, and during mkdocs gh-deploy). | |
# I don't know if this is a problem or not. | |
# Building docs for Python packages | |
echo "Building docs of Python packages..." | |
source /home/ubm/mkdocs/bin/activate | |
for f in $(find ./ubm-f1tenth -type f -iname "mkdocs.yml"); do | |
package_dir="${f%/mkdocs.yml}" | |
package_name="${package_dir##*/}" | |
echo "Building $package_name with mkdocs" | |
python -m mkdocs build -f "$f" -d "$PYTHON_DOCS_DIR/$package_name" | |
done | |
- name: Copy excluded directories to site/ | |
run: | | |
mv ./docs/cpp_packages ./site/ | |
mv ./docs/python_packages ./site/ | |
- name: Configure Git for Deployment | |
run: | | |
git config --global --add safe.directory /__w/ubm-docs/ubm-docs | |
- name: Deploy to GitHub Pages | |
run: | | |
source /home/ubm/mkdocs/bin/activate | |
mkdocs gh-deploy --force |