From 1a92e3d4183baca0fa184e66ca33d3dff136ed3c Mon Sep 17 00:00:00 2001 From: peteGSX <97784652+peteGSX@users.noreply.github.com> Date: Wed, 5 Feb 2025 09:58:48 +1000 Subject: [PATCH] Try versions --- .github/workflows/docs.yml | 24 ++++++++++++++++++++---- docs/Makefile | 10 +++++++++- docs/conf.py | 15 +++++---------- docs/make.bat | 9 ++++++++- 4 files changed, 42 insertions(+), 16 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 46302d3..61c06ce 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -2,7 +2,9 @@ name: Docs on: push: - branches: [ master-exraildoc ] + branches: + - master-exraildoc + - master-exraildocdev pull_request: branches: [ master ] workflow_dispatch: @@ -11,17 +13,31 @@ jobs: build: runs-on: ubuntu-latest steps: - - name: Checkout repo + - name: Checkout uses: actions/checkout@v4.1.1 - - name: Requirements + with: + fetch-depth: 0 + + - name: Install Requirements run: | + python -m pip install --upgrade pip pip3 install -r requirements.txt sudo apt-get install doxygen - - name: Build docs + + - name: Build Devel docs run: | + git checkout master-exraildocdev + cd docs + make html + cd .. + + - name: Build Prod docs + run: | + git checkout master-exraildoc cd docs make html touch _build/html/.nojekyll + - name: Deploy uses: JamesIves/github-pages-deploy-action@ba1486788b0490a235422264426c45848eac35c6 with: diff --git a/docs/Makefile b/docs/Makefile index d4bb2cb..100a499 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -6,7 +6,15 @@ SPHINXOPTS ?= SPHINXBUILD ?= sphinx-build SOURCEDIR = . -BUILDDIR = _build +# BUILDDIR = _build + +# Determine build directory based on git branch +BRANCH := $(shell git rev-parse --abbrev-ref HEAD) +ifeq ($(BRANCH),master-exraildocdev) + BUILDDIR = _build/devel +else + BUILDDIR = _build +endif # Put it first so that "make" without argument is like "make help". help: diff --git a/docs/conf.py b/docs/conf.py index 89884b1..089a66e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -53,7 +53,6 @@ numfig_format = {'figure': 'Figure %s'} # -- Options for HTML output ------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output - html_theme = 'sphinx_rtd_theme' html_static_path = ['_static'] @@ -88,19 +87,15 @@ html_css_files = [ baseurl_prefix = 'https://dcc-ex.com/CommandStation-EX/' -# Change output directory depending on branch -if current_branch in ['master-exraildoc', 'master-exraildocdev']: +# Devel documentation needs to be a different directory +if current_branch == 'master-exraildocdev': # For versioning - html_baseurl = f"{baseurl_prefix}{current_branch}/" - html_extra_path = ['_build'] - builddir = os.path.join('_build', current_branch) + html_baseurl = f"{baseurl_prefix}devel/" + html_build_dir = os.path.abspath(os.path.join('_build', 'devel')) else: # Main landing page html_baseurl = baseurl_prefix - builddir = '_build' - -# Override default build directory -sphinx.builders.html.get_outfilename = lambda self, pagename: os.path.join(builddir, pagename + '.html') + html_build_dir = os.path.abspath('_build') # Sphinx sitemap html_extra_path = [ diff --git a/docs/make.bat b/docs/make.bat index 954237b..a2c139d 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -8,7 +8,14 @@ if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) set SOURCEDIR=. -set BUILDDIR=_build +@REM set BUILDDIR=_build + +for /f "tokens=*" %%g in ('git rev-parse --abbrev-ref HEAD') do (set BRANCH=%%g) +if "%BRANCH%"=="master-exraildocdev" ( + set BUILDDIR=_build\devel +) else ( + set BUILDDIR=_build +) %SPHINXBUILD% >NUL 2>NUL if errorlevel 9009 (