From 3ad247b9a7a8e97895ac5eca8b5df432feb07f93 Mon Sep 17 00:00:00 2001 From: John Yani <361985+Vanuan@users.noreply.github.com> Date: Mon, 20 Jan 2025 10:13:21 +0000 Subject: [PATCH] Automatic build and deploy bonsai docs on push (#5994) * Create docs-deployment.yml * Update docs-deployment.yml Add CNAME * Update docs-deployment.yml * Create docs-deployment-unstable.yml * Add requirements.txt --- .../workflows/docs-deployment-unstable.yml | 38 +++++++++++++++++++ .github/workflows/docs-deployment.yml | 36 ++++++++++++++++++ src/bonsai/docs/requirements.txt | 4 ++ 3 files changed, 78 insertions(+) create mode 100644 .github/workflows/docs-deployment-unstable.yml create mode 100644 .github/workflows/docs-deployment.yml create mode 100644 src/bonsai/docs/requirements.txt diff --git a/.github/workflows/docs-deployment-unstable.yml b/.github/workflows/docs-deployment-unstable.yml new file mode 100644 index 0000000000..4180da6bf4 --- /dev/null +++ b/.github/workflows/docs-deployment-unstable.yml @@ -0,0 +1,38 @@ +name: Build and Deploy Unstable Documentation + +on: + push: + branches: + - main # Trigger the workflow on pushes to the main branch + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + cd src/bonsai/docs # Navigate to the docs directory + pip install -r requirements.txt # Install dependencies from requirements.txt + + - name: Build documentation + run: | + cd src/bonsai/docs # Navigate to the docs directory + make html # Build the documentation + + - name: Deploy to GitHub Pages (Unstable) + uses: peaceiris/actions-gh-pages@v4 + with: + deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} # SSH key for deployment + external_repository: IfcOpenShell/bonsaibim_org_docs_unstable # Target repository + publish_branch: main # Branch to deploy to + cname: docs-unstable.bonsaibim.org # Custom domain for unstable docs + publish_dir: src/bonsai/docs/_build/html # Directory containing built docs \ No newline at end of file diff --git a/.github/workflows/docs-deployment.yml b/.github/workflows/docs-deployment.yml new file mode 100644 index 0000000000..dd2284d333 --- /dev/null +++ b/.github/workflows/docs-deployment.yml @@ -0,0 +1,36 @@ +name: Build and Deploy Stable Documentation + +on: + workflow_dispatch: # Manual trigger + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + cd src/bonsai/docs + pip install -r requirements.txt # Run pip install from the docs directory + + - name: Build documentation + run: | + cd src/bonsai/docs + make html + + - name: Deploy to GitHub Pages (Stable) + uses: peaceiris/actions-gh-pages@v4 + with: + deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} + external_repository: IfcOpenShell/bonsaibim_org_docs + publish_branch: main + cname: docs.bonsaibim.org + publish_dir: src/bonsai/docs/_build/html \ No newline at end of file diff --git a/src/bonsai/docs/requirements.txt b/src/bonsai/docs/requirements.txt new file mode 100644 index 0000000000..83e32af32b --- /dev/null +++ b/src/bonsai/docs/requirements.txt @@ -0,0 +1,4 @@ +sphinx +furo +sphinx-autoapi +sphinx-copybutton \ No newline at end of file