-
Notifications
You must be signed in to change notification settings - Fork 127
75 lines (70 loc) · 2.61 KB
/
build-docs.yml
File metadata and controls
75 lines (70 loc) · 2.61 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
name: Build docs
on:
workflow_dispatch:
inputs:
use_cache:
description: "Use cached notebooks for unchanged sources"
type: boolean
default: true
release:
types:
- published
jobs:
build-notebooks:
uses: ./.github/workflows/build-notebooks.yml
with:
use_cache: ${{ github.event_name == 'workflow_dispatch' && inputs.use_cache || false }}
secrets: inherit
deploy:
needs: build-notebooks
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "0.9.5"
- name: Set up Python
run: uv python install 3.11
- name: Install dependencies for docs
run: uv sync --all-packages --group docs
- name: Download artifact from previous step
uses: actions/download-artifact@v7
with:
name: notebooks
path: docs/notebooks
- name: Find the latest existing release tag
id: get_release
run: |
if [ "${{ github.event_name }}" == "release" ]; then
LATEST_TAG="${{ github.event.release.tag_name }}"
else
echo "::notice::Running manually via workflow_dispatch. Fetching latest release tag..."
gh auth status || echo "GitHub CLI is not authenticated, relying on GITHUB_TOKEN."
# We use tr -d '\n' to remove the trailing newline for a clean tag string
LATEST_TAG=$(gh release view --json tagName -q .tagName 2>/dev/null)
if [ -z "$LATEST_TAG" ]; then
echo "::error::Could not find the latest published release tag. Ensure a release exists."
exit 1
fi
fi
echo "Latest release tag found: $LATEST_TAG"
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version from release tag
run: |
# Remove the 'v' prefix and any suffix after a space
VERSION=$(echo ${{ env.LATEST_TAG }} | sed 's/^v//' | sed 's/ .*$//')
echo "::notice::Extracted version: $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Setup doc deploy
run: |
git fetch origin gh-pages --depth=1
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Build and deploy docs
run: uv run mike deploy --push --update-aliases ${{ env.VERSION }} latest