Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Build Docs
permissions: read-all

on:
workflow_dispatch: # run on request (no need for PR)
push:
branches:
- master

jobs:
Build-Docs:
runs-on: ubuntu-20.04
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: pip install 'model_api/python/.[docs]'
- name: Install and Generate Doxygen
uses: mattnotmitt/[email protected]
- name: Build Docs
run: |
cd docs
make html
- name: Create gh-pages branch
run: |
if [[ ${{github.event_name}} == 'workflow_dispatch' ]]; then
echo RELEASE_VERSION="test_build" >> $GITHUB_ENV
else
echo RELEASE_VERSION=${GITHUB_REF#refs/*/} >> $GITHUB_ENV
fi
echo SOURCE_NAME=${GITHUB_REF#refs/*/} >> $GITHUB_OUTPUT
echo SOURCE_BRANCH=${GITHUB_REF#refs/heads/} >> $GITHUB_OUTPUT
echo SOURCE_TAG=${GITHUB_REF#refs/tags/} >> $GITHUB_OUTPUT

existed_in_remote=$(git ls-remote --heads origin gh-pages)

if [[ -z ${existed_in_remote} ]]; then
echo "Creating gh-pages branch"
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git checkout --orphan gh-pages
git reset --hard
touch .nojekyll
git add .nojekyll
git commit -m "Initializing gh-pages branch"
git push origin gh-pages
git checkout ${{steps.branch_name.outputs.SOURCE_NAME}}
echo "Created gh-pages branch"
else
echo "Branch gh-pages already exists"
fi
- name: Commit docs to gh-pages branch
run: |
git fetch
git checkout gh-pages
mkdir -p /tmp/docs_build
cp -r docs/build/html/* /tmp/docs_build/
rm -rf ${{ env.RELEASE_VERSION }}/*
echo '<html><head><meta http-equiv="refresh" content="0; url=stable/" /></head></html>' > index.html
mkdir -p ${{ env.RELEASE_VERSION }}
cp -r /tmp/docs_build/* ./${{ env.RELEASE_VERSION }}
rm -rf /tmp/docs_build
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
if [[ ${{ env.RELEASE_VERSION }} != 'test_build' ]]; then
ln -sfn ${{ env.RELEASE_VERSION }} latest
fi
git add ./latest ${{ env.RELEASE_VERSION }}
git commit -m "Update documentation" -a || true
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
4 changes: 4 additions & 0 deletions .github/workflows/pre_commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install clang-format
run: sudo apt-get install -y clang-format-10
- name: Install dependencies
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,10 @@ dmypy.json
# Pyre type checker
.pyre/

# Sphinx documentation
docs/build/
docs/build_cpp/
docs/source/_build/

# vs-code
.vscode/
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
default_language_version:
node: 18.15.0
node: 22.10.0

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down
Loading
Loading