-
-
Notifications
You must be signed in to change notification settings - Fork 2k
80 lines (70 loc) · 2.35 KB
/
docs-python.yml
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
name: Build Python documentation
on:
pull_request:
paths:
- py-polars/docs/**
- py-polars/polars/**
- .github/workflows/docs-python.yml
push:
branches:
- main
paths:
- py-polars/docs/**
- py-polars/polars/**
- .github/workflows/docs-python.yml
tags:
- py-**
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
build-python-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: pip
cache-dependency-path: py-polars/docs/requirements-docs.txt
- name: Install Python dependencies
working-directory: py-polars/docs
run: pip install -r requirements-docs.txt
- name: Build Python documentation
working-directory: py-polars/docs
env:
SPHINXOPTS: -W --jobs=auto
POLARS_VERSION: ${{ github.ref_name }}
run: make html
- name: Deploy Python docs for latest development version
if: ${{ github.ref_name == 'main' }}
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: py-polars/docs/build/html
target-folder: docs/python/dev
single-commit: true
- name: Parse the tag to find the major/minor version of Polars
id: version
if: ${{ github.ref_type == 'tag' }}
shell: bash
run: |
tag="${{ github.ref_name }}"
regex="py-([0-9]+\.[0-9]+)\.[0-9]+.*"
[[ $tag =~ $regex ]]
version=${BASH_REMATCH[1]}
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Deploy Python docs for latest release version - versioned
if: ${{ github.ref_type == 'tag' }}
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: py-polars/docs/build/html
target-folder: docs/python/version/${{ steps.version.outputs.version }}
single-commit: true
- name: Deploy Python docs for latest release version - stable
if: ${{ github.ref_type == 'tag' }}
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: py-polars/docs/build/html
# Keeping this folder for backwards compatibility
target-folder: py-polars/html
single-commit: true