Skip to content

Commit f1c0637

Browse files
committed
make -C docs
1 parent 0a37916 commit f1c0637

2 files changed

Lines changed: 26 additions & 36 deletions

File tree

.github/workflows/build.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,22 +91,14 @@ jobs:
9191
- id: pages
9292
uses: actions/configure-pages@v3
9393
- name: update web pages (jekyll)
94+
run: make JEKYLLOPTS="--baseurl ${{ steps.pages.outputs.base_path }}" web-deps web
9495
env: {JEKYLL_ENV: production}
95-
run: |
96-
bundle install
97-
bundle exec jekyll build -s pages --baseurl "${{ steps.pages.outputs.base_path }}"
98-
# overwrite old files
99-
ls pages/*.md | xargs -II basename I .md | xargs -II rm -rf build/I
100-
rm -rf build/.git build/assets
101-
mv _site/* build/
10296
- name: update docs pages (sphinx)
10397
run: |
10498
docs_dir="${{ github.ref_name }}"
10599
docs_dir="${docs_dir//\//_}"
106100
if test "$docs_dir" = master; then docs_dir=nightly; fi
107-
rm -rf "build/$docs_dir"
108-
sphinx-build -b dirhtml source "build/$docs_dir"
109-
./mkversions.py
101+
make BUILDSUBDIR="$docs_dir" dirhtml
110102
- uses: actions/upload-artifact@v4
111103
with:
112104
name: DocumentationHTML

docs/Makefile

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,36 @@
1-
## -*- coding: utf-8 -*-
2-
## Copyright 2019 United Kingdom Research and Innovation
3-
## Copyright 2019 The University of Manchester
4-
##
5-
## Licensed under the Apache License, Version 2.0 (the "License");
6-
## you may not use this file except in compliance with the License.
7-
## You may obtain a copy of the License at
8-
##
9-
## http://www.apache.org/licenses/LICENSE-2.0
10-
##
11-
## Unless required by applicable law or agreed to in writing, software
12-
## distributed under the License is distributed on an "AS IS" BASIS,
13-
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
## See the License for the specific language governing permissions and
15-
## limitations under the License.
16-
##
17-
## Authors:
18-
## CIL Developers, listed at: https://github.com/TomographicImaging/CIL/blob/master/NOTICE.txt
19-
20-
# Minimal makefile for Sphinx documentation
21-
#
22-
231
# You can set these variables from the command line.
2+
JEKYLLOPTS =
3+
JEKYLLBUILD = bundle exec jekyll build
4+
JEKYLLSRCDIR = pages
245
SPHINXOPTS =
256
SPHINXBUILD = sphinx-build
267
SOURCEDIR = source
278
BUILDDIR = build
28-
29-
# Put it first so that "make" without argument is like "make help".
9+
BUILDSUBDIR = $(shell git rev-parse --abbrev-ref HEAD)
3010
help:
3111
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
12+
@echo extra options
13+
@echo ' web-deps to install website dependencies'
14+
@echo ' web to build website'
15+
@echo ' dirhtml to build docs'
16+
@echo ' serve to serve website & docs'
17+
.PHONY: help Makefile serve web-deps web dirhtml
3218

33-
.PHONY: help Makefile
19+
serve:
20+
@python -m http.server -d "$(BUILDDIR)"
21+
web-deps:
22+
@bundle install
23+
web:
24+
@$(JEKYLLBUILD) -s "$(JEKYLLSRCDIR)" $(JEKYLLOPTS)
25+
@ls "$(JEKYLLSRCDIR)"/*.md | xargs -II basename I .md | xargs -II rm -rf "$(BUILDDIR)/I"
26+
@rm -rf "$(BUILDDIR)/assets"
27+
@mv _site/* "$(BUILDDIR)/"
28+
dirhtml:
29+
@rm -rf "$(BUILDDIR)/$(BUILDSUBDIR)"
30+
@$(SPHINXBUILD) -b dirhtml $(SPHINXOPTS) "$(SOURCEDIR)" "$(BUILDDIR)/$(BUILDSUBDIR)"
31+
@./mkversions.py
3432

3533
# Catch-all target: route all unknown targets to Sphinx using the new
3634
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
3735
%: Makefile
38-
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
36+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

0 commit comments

Comments
 (0)