forked from cvxpy/cvxpy
-
Notifications
You must be signed in to change notification settings - Fork 4
64 lines (56 loc) · 1.87 KB
/
docs.yml
File metadata and controls
64 lines (56 loc) · 1.87 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
name: doc_deploy
on:
workflow_dispatch:
jobs:
doc_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Get deployed versions from gh-pages
uses: actions/checkout@v5
with:
ref: gh-pages
- name: Set already deployed versions
run: |
python -m pip install packaging
echo LATEST_DEPLOYED_VERSION=$(python -c "
import os
from packaging import version
versions = [version.parse(v) for v in os.listdir('version')]
print(sorted(versions)[-1])
") >> $GITHUB_ENV
- name: Checkout current branch
uses: actions/checkout@v5
- name: Build docs
run: |
python -m pip install -e .
python -m pip install -r doc/requirements.txt
cd doc
make html
- name: Set current version
run: |
CURRENT_VERSION=$(python -c "
import cvxpy
print('.'.join(cvxpy.__version__.split('.')[:2]))
")
echo CURRENT_VERSION=$CURRENT_VERSION >> $GITHUB_ENV
echo VERSION_PATH=/version/$CURRENT_VERSION >> $GITHUB_ENV
DEPLOY_LATEST=$(python continuous_integration/doc_is_latest.py \
--c "$CURRENT_VERSION" --l "$LATEST_DEPLOYED_VERSION")
echo DEPLOY_LATEST=$DEPLOY_LATEST >> $GITHUB_ENV
- name: Deploy this version
uses: JamesIves/github-pages-deploy-action@v4.8.0
with:
branch: gh-pages
folder: doc/build/html
target-folder: ${{ env.VERSION_PATH }}
- name: Deploy to root if latest version
if: ${{ env.DEPLOY_LATEST == 'True' }}
uses: JamesIves/github-pages-deploy-action@v4.8.0
with:
branch: gh-pages
folder: doc/build/html
clean-exclude: |
version/