Skip to content

Commit ec2f985

Browse files
committed
Add mkdocs targets and publishing workflow
1 parent 26adce1 commit ec2f985

2 files changed

Lines changed: 83 additions & 1 deletion

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Publish gh-pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
10+
cancel-in-progress: true
11+
12+
permissions:
13+
contents: write
14+
15+
jobs:
16+
Publish-gh-pages:
17+
if: github.event.pull_request.draft == false
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Set up Python 3.11
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: '3.11'
29+
30+
- name: Install Poetry
31+
run: |
32+
pip install poetry
33+
34+
- name: Cache Poetry virtualenv and dependencies
35+
uses: actions/cache@v4
36+
with:
37+
path: |
38+
~/.cache/pypoetry
39+
~/.cache/pip
40+
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
41+
restore-keys: |
42+
poetry-${{ runner.os }}-
43+
44+
- name: Install dependencies
45+
run: |
46+
make install
47+
48+
- name: Run mkdocs deploy
49+
run: |
50+
poetry run mkdocs gh-deploy
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Makefile.targets

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,34 @@
55

66
.PHONY: test-notebooks
77
test-notebooks: ## Execute test notebooks using pytest and nbval
8-
$(ENV_COMMAND_TOOL) nox -s test_nb
8+
$(ENV_COMMAND_TOOL) nox -s test_nb
9+
10+
## -- Docs targets -------------------------------------------------------------------------------------------------- ##
11+
.PHONY: preview-docs
12+
preview-docs: ## Preview the documentation site locally
13+
@poetry run mkdocs serve -a 0.0.0.0:7000
14+
15+
16+
.PHONY: build-docs
17+
build-docs: ## Build the documentation files locally
18+
@poetry run mkdocs build
19+
20+
.PHONY: deploy-docs
21+
deploy-docs: ## Publish and deploy the documentation to the live Github page
22+
@echo""; \
23+
echo -e "\e[1;39;41m-- WARNING --\e[0m This command will deploy all current changes to the live Github page - Making it publicly available"; \
24+
echo""; \
25+
echo -n "Would you like to deploys the docs? [Y/n]: "; \
26+
read ans; \
27+
case $$ans in \
28+
[Yy]*) \
29+
echo""; \
30+
poetry run mkdocs gh-deploy; \
31+
echo""; \
32+
;; \
33+
*) \
34+
echo""; \
35+
echo "Skipping publication to Github Pages."; \
36+
echo " "; \
37+
;; \
38+
esac; \

0 commit comments

Comments
 (0)