mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-02-26 18:46:04 +01:00
Merge pull request #438 from DCC-EX:master-exraildocdev
Update template
This commit is contained in:
commit
eb09985480
24
.github/workflows/docs.yml
vendored
24
.github/workflows/docs.yml
vendored
@ -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:
|
||||
|
@ -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:
|
||||
|
4
docs/_templates/layout.html
vendored
4
docs/_templates/layout.html
vendored
@ -7,10 +7,10 @@
|
||||
<div class="version-wrapper">
|
||||
<label for="version-switch">Documentation Version:</label>
|
||||
<select id="version-switch" onchange="window.location.href=this.value">
|
||||
<option value="/{{ project|lower }}/master-exraildoc/"{% if version == "main" %} selected{% endif %}>
|
||||
<option value="/CommandStation-EX/"{% if version == "main" %} selected{% endif %}>
|
||||
Production
|
||||
</option>
|
||||
<option value="/{{ project|lower }}/master-exraildocdev/"{% if version == "devel" %} selected{% endif %}>
|
||||
<option value="/CommandStation-EX/devel/"{% if version == "devel" %} selected{% endif %}>
|
||||
Development
|
||||
</option>
|
||||
</select>
|
||||
|
15
docs/conf.py
15
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 = [
|
||||
|
@ -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 (
|
||||
|
Loading…
Reference in New Issue
Block a user