Skip to content

Commit

Permalink
build ReadTheDocs with pre_build rules that set up style links from D…
Browse files Browse the repository at this point in the history
…EPLOY_TARGET env var
  • Loading branch information
benkirk committed Jan 20, 2024
1 parent 4d523bc commit b0dfbe7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
16 changes: 14 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,21 @@ version: 2

# Set the version of Python and other tools you might need
build:
os: "ubuntu-22.04"
os: ubuntu-22.04
tools:
python: "mambaforge-22.9"
python: mambaforge-22.9
jobs:
pre_build:
# just nice to know what's happening up there...
- env | sort | uniq

# DEPLOY_TARGET is set in our readthedocs admin interface, and should
# be one of the supported targets: [ primary, arc_iframe ]
- make ${DEPLOY_TARGET}-stylelinks

# the above may generate a dirty git cache for some committed symbolic links - ignore. ref:
# https://docs.readthedocs.io/en/stable/build-customization.html#avoid-having-a-dirty-git-index
- git update-index --assume-unchanged theme.yml docs/stylesheets/custom.css

conda:
environment: conda.yaml
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ dos2unix:
dos2unix $$file ; \
done

primary-links arc_iframe-links:
target=$(subst -links,,$@) ; \
primary-stylelinks arc_iframe-stylelinks:
topdir=$$(pwd) ; \
target=$(subst -stylelinks,,$@) ; \
cd $${topdir} && ln -sf theme_$${target}.yml theme.yml ; \
cd $${topdir}//docs/stylesheets/ && ln -sf $${target}.css custom.css
cd $${topdir}/docs/stylesheets/ && ln -sf $${target}.css custom.css

0 comments on commit b0dfbe7

Please sign in to comment.