FIX: docs build #72
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
name: Build and Deploy | |
on: | |
push: | |
branches: | |
- develop | |
pull_request: | |
branches: | |
- develop | |
jobs: | |
build-docs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Checkout LFS objects | |
run: git lfs checkout | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install mdbtools | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y mdbtools | |
- name: Install Poetry | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
echo "export PATH=$HOME/.local/bin:\$PATH" >> $GITHUB_ENV | |
- name: Cache Poetry dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pypoetry | |
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-poetry- | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Cache Node.js dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install Node.js dependencies | |
run: | | |
npm install | |
- name: Install dependencies | |
run: | | |
poetry install | |
- name: Build Sphinx documentation | |
run: | | |
poetry run sphinx-build -b html docs/source docs/build/html | |
- name: Upload documentation as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docs | |
path: docs/build/html | |
deploy-docs: | |
needs: build-docs | |
if: github.event_name == 'push' && github.ref == 'refs/heads/develop' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download documentation artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: docs | |
path: docs/build/html | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs/build/html | |
build-schema: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Checkout LFS objects | |
run: git lfs checkout | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install mdbtools | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y mdbtools | |
- name: Install Poetry | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
echo "export PATH=$HOME/.local/bin:\$PATH" >> $GITHUB_ENV | |
- name: Cache Poetry dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pypoetry | |
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-poetry- | |
- name: Install dependencies | |
run: | | |
poetry install | |
- name: Build Schema | |
run: | | |
poetry run python schema/build_schema.py | |
- name: Upload Schema as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: schema | |
path: schema | |
deploy-schema: | |
needs: build-schema | |
if: github.event_name == 'push' && github.ref == 'refs/heads/develop' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Download Schema artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: schema | |
path: schema | |
- name: Set up Git user | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
- name: Create schema branch if it doesn't exist | |
run: | | |
git fetch origin | |
if ! git rev-parse --verify origin/schema; then | |
git checkout --orphan schema | |
git rm -rf . | |
mkdir -p schema | |
touch schema/.gitkeep | |
git add schema/.gitkeep | |
git commit -m "Initialize schema branch with schema folder" | |
git push -u origin schema | |
fi | |
- name: Switch to schema branch | |
run: | | |
git fetch origin schema | |
git checkout schema | |
- name: Copy schema artifact to schema folder | |
run: | | |
cp -R schema/* . | |
- name: Commit and push schema updates | |
run: | | |
git add schema | |
git commit -m "Update schema files" | |
git push origin schema |