Skip to content

Commit b5ca6c2

Browse files
authored
deploy docs (#65)
1 parent 06e6f2d commit b5ca6c2

File tree

2 files changed

+75
-1
lines changed

2 files changed

+75
-1
lines changed
+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Publish Python docs
2+
3+
# Only run on new tags starting with `py-v`
4+
on:
5+
push:
6+
tags:
7+
- "py-v*"
8+
workflow_dispatch:
9+
10+
# https://stackoverflow.com/a/77412363
11+
permissions:
12+
contents: write
13+
pages: write
14+
15+
jobs:
16+
build:
17+
name: Deploy Python docs
18+
runs-on: ubuntu-latest
19+
defaults:
20+
run:
21+
working-directory: python
22+
steps:
23+
- uses: actions/checkout@v4
24+
# We need to additionally fetch the gh-pages branch for mike deploy
25+
with:
26+
fetch-depth: 0
27+
submodules: "true"
28+
29+
- name: Install Rust
30+
uses: dtolnay/rust-toolchain@stable
31+
32+
- uses: Swatinem/rust-cache@v2
33+
34+
- name: Install a specific version of uv
35+
uses: astral-sh/setup-uv@v5
36+
with:
37+
enable-cache: true
38+
version: "0.5.x"
39+
40+
- name: Set up Python 3.11
41+
run: uv python install 3.11
42+
43+
- name: Install dependencies
44+
run: uv sync --no-install-package async-tiff
45+
46+
- name: Build python packages
47+
run: |
48+
uv run --no-project maturin develop
49+
50+
- name: Deploy docs
51+
env:
52+
GIT_COMMITTER_NAME: CI
53+
GIT_COMMITTER_EMAIL: [email protected]
54+
run: |
55+
# Get most recent git tag
56+
# https://stackoverflow.com/a/7261049
57+
# https://stackoverflow.com/a/3867811
58+
# We don't use {{github.ref_name}} because if triggered manually, it
59+
# will be a branch name instead of a tag version.
60+
# Then remove `py-` from the tag
61+
VERSION=$(git describe --tags --match="py-*" --abbrev=0 | cut -c 4-)
62+
63+
# Only push publish docs as latest version if no letters in git tag
64+
# after the first character
65+
# (usually the git tag will have v as the first character)
66+
# Note the `cut` index is 1-ordered
67+
if echo $VERSION | cut -c 2- | grep -q "[A-Za-z]"; then
68+
echo "Is beta version"
69+
# For beta versions publish but don't set as latest
70+
uv run --no-project mike deploy $VERSION --update-aliases --push
71+
else
72+
echo "Is NOT beta version"
73+
uv run --no-project mike deploy $VERSION latest --update-aliases --push
74+
fi

python/docs/api/tiff.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
::: async_tiff.TIFF
44
options:
55
show_if_no_docstring: true
6-
::: async_tiff.ObspecReader
6+
::: async_tiff.ObspecInput

0 commit comments

Comments
 (0)