Skip to content

Commit 58c232f

Browse files
authored
chore: Update docs website and publishing script (#10)
* Update docs website * Add API docs * update docs publish script * lint docs * update contributing docs
1 parent 0493452 commit 58c232f

File tree

19 files changed

+1134
-107
lines changed

19 files changed

+1134
-107
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ jobs:
2121
with:
2222
version: "latest"
2323

24-
# Ensure docs build without warnings
25-
# - name: Check docs
26-
# run: uv run --group docs mkdocs build --strict
24+
- name: Ensure docs build without warnings
25+
run: uv run --group docs mkdocs build --strict
2726

2827
# Use ruff-action so we get annotations in the Github UI
2928
- uses: astral-sh/ruff-action@v3
Lines changed: 44 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,57 @@
1-
name: Publish docs via GitHub Pages
1+
name: Publish Python docs
22

3+
# Only run on new tags starting with `v`
34
on:
45
push:
5-
branches:
6-
- main
7-
paths:
8-
# Only rebuild website when docs have changed
9-
- 'README.md'
10-
- 'docs/**'
11-
- 'mkdocs.yml'
12-
- 'rio_stac/**.py'
13-
- .github/workflows/deploy_mkdocs.yml
6+
tags:
7+
- "v*"
8+
workflow_dispatch:
9+
10+
# https://stackoverflow.com/a/77412363
11+
permissions:
12+
contents: write
13+
pages: write
1414

1515
jobs:
1616
build:
17-
name: Deploy docs
17+
name: Deploy Python docs
1818
runs-on: ubuntu-latest
19+
# Used for configuring social plugin in mkdocs.yml
20+
# Unclear if this is always set in github actions
21+
env:
22+
CI: "TRUE"
1923
steps:
20-
- name: Checkout main
21-
uses: actions/checkout@v5
24+
- uses: actions/checkout@v4
25+
# We need to additionally fetch the gh-pages branch for mike deploy
26+
with:
27+
fetch-depth: 0
2228

23-
- name: Set up Python 3.12
24-
uses: actions/setup-python@v6
29+
- uses: astral-sh/setup-uv@v5
2530
with:
26-
python-version: 3.12
31+
enable-cache: true
2732

28-
- name: Install dependencies
33+
- name: Deploy docs
34+
env:
35+
GIT_COMMITTER_NAME: CI
36+
GIT_COMMITTER_EMAIL: ci-bot@example.com
2937
run: |
30-
python -m pip install --upgrade pip
31-
python -m pip install -e .["doc"]
38+
# Get most recent git tag
39+
# https://stackoverflow.com/a/7261049
40+
# https://stackoverflow.com/a/3867811
41+
# We don't use {{github.ref_name}} because if triggered manually, it
42+
# will be a branch name instead of a tag version.
43+
VERSION=$(git describe --tags --match="v*" --abbrev=0)
44+
echo $VERSION
3245
33-
- name: Deploy docs
34-
run: mkdocs gh-deploy -f docs/mkdocs.yml --force
46+
# Only push publish docs as latest version if no letters in git tag
47+
# after the first character
48+
# (usually the git tag will have v as the first character)
49+
# Note the `cut` index is 1-ordered
50+
if echo $VERSION | cut -c 2- | grep -q "[A-Za-z]"; then
51+
echo "Is beta version"
52+
# For beta versions publish but don't set as latest
53+
uv run --group docs mike deploy $VERSION --update-aliases --push
54+
else
55+
echo "Is NOT beta version"
56+
uv run --group docs mike deploy $VERSION latest --update-aliases --push
57+
fi
File renamed without changes.

CONTRIBUTING.md renamed to DEVELOP.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,15 @@ This repo is set to use `pre-commit` to run *isort*, *flake8*, *pydocstring*, *b
2323
```bash
2424
$ pre-commit install
2525
```
26+
27+
## Documentation
28+
29+
### Building locally
30+
31+
```
32+
uv run --group docs mkdocs serve
33+
```
34+
35+
### Publishing docs
36+
37+
Documentation is automatically published when a new tag with `v*` is pushed to `main`. Alternatively, you can manually publish docs by triggering the docs publish workflow from the GitHub actions UI.

docs/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../CHANGELOG.md

docs/DEVELOP.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../DEVELOP.md

docs/api.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# API Documentation
2+
3+
::: async_pmtiles

docs/assets/logo_no_text.png

4.53 KB
Loading

docs/blog/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Blog
2+

docs/docs/contributing.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)