-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (90 loc) · 3.74 KB
/
Copy pathstatic.yml
File metadata and controls
105 lines (90 loc) · 3.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Also run after the build & publish (release) workflow completes
workflow_run:
workflows: ["Build and Publish Wheels"]
types:
- completed
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Checkout latest version tag (post-release)
if: github.event_name == 'workflow_run'
run: |
set -e
git fetch --tags --force
TAG=$(git tag --list 'v*' --sort=-creatordate | head -1)
echo "Latest tag detected: $TAG"
if [ -n "$TAG" ]; then
git checkout "$TAG"
else
echo "No version tag found; using current branch."
fi
- name: Install Rust toolchain (for potential extension build)
uses: dtolnay/rust-toolchain@stable
- name: Set up Python 3.11
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install docs dependencies
run: |
set -e
uv pip install --system .[docs]
- name: Force version synchronization (pyproject -> package & stubs)
run: |
set -e
PYPROJECT_VERSION=$(grep -E '^version = "' pyproject.toml | head -1 | cut -d'"' -f2)
echo "Pyproject version: $PYPROJECT_VERSION"
# Overwrite __version__ in Python package source before install
sed -i.bak -E "s/__version__ = \".*\"/__version__ = \"$PYPROJECT_VERSION\"/" python/eo_processor/__init__.py
# Overwrite Literal version in type stubs if present
sed -i.bak -E "s/__version__: Literal\\[\"[^\"]+\"\\]/__version__: Literal[\"$PYPROJECT_VERSION\"]/" python/eo_processor/__init__.pyi || true
echo "Re-installing package with synchronized version..."
uv pip install --system .[docs]
# Prefer local source for import precedence (conf.py adds path but we ensure here)
echo "PYTHONPATH=$PWD/python:$PYTHONPATH" >> $GITHUB_ENV
# Validate imported version matches pyproject
PKG_VERSION=$(python -c 'import eo_processor; print(eo_processor.__version__)')
echo "Post-install package __version__: $PKG_VERSION"
if [ "$PKG_VERSION" != "$PYPROJECT_VERSION" ]; then
echo "Version synchronization failed"; exit 1
fi
- name: Build Sphinx documentation (forced version)
run: |
set -e
PYPROJECT_VERSION=$(grep -E '^version = "' pyproject.toml | head -1 | cut -d'"' -f2)
echo "Building docs for version: $PYPROJECT_VERSION"
# Ensure any cached bytecode doesn't hold old version
find python/eo_processor -name '*.pyc' -delete || true
make docs
- name: Upload artifact
uses: actions/upload-pages-artifact@v5
with:
path: "docs/build/html"
- name: Setup Pages
uses: actions/configure-pages@v6
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5