36
36
- docs/cyclops-webpage
37
37
38
38
jobs :
39
+ check_release :
40
+ runs-on : ubuntu-latest
41
+ outputs :
42
+ is_release : ${{ steps.check_release.outputs.is_release }}
43
+ steps :
44
+ - name : Check if release PR
45
+ id : check_release
46
+ if : github.event_name == 'pull_request'
47
+ run : |
48
+ if [[ ${{ contains(github.event.pull_request.labels.*.name, 'release') }} == 'true' ]]; then
49
+ echo "is_release=true" >> $GITHUB_OUTPUT
50
+ else
51
+ echo "is_release=false" >> $GITHUB_OUTPUT
52
+ fi
53
+
39
54
build :
55
+ needs : check_release
40
56
if : github.event_name == 'push' || (github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'synchronize' || (github.event.action == 'closed' && github.event.pull_request.merged == true)))
41
- runs-on : ubuntu-latest
57
+ runs-on : ${{ needs.check_release.outputs.is_release == 'true' && fromJSON('["self-hosted", "db", "cyclops"]') || ' ubuntu-latest' }}
42
58
steps :
43
59
- uses : actions/checkout@v4.1.7
44
60
with :
@@ -49,20 +65,23 @@ jobs:
49
65
with :
50
66
python-version : ' 3.10'
51
67
cache : ' poetry'
52
- - name : Install dependencies, build docs without running notebooks
68
+ - name : Install dependencies, build docs
53
69
run : |
54
70
python3 -m pip install --upgrade pip && python3 -m pip install poetry
55
71
poetry env use '3.10'
56
72
source $(poetry env info --path)/bin/activate
57
73
poetry install --with docs,test --all-extras
58
74
59
- # Install Pandoc
60
- PANDOC_VERSION="2.19"
61
- curl -sLo- "https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-linux-amd64.tar.gz" | tar xzf - --strip-components 2 -C /usr/local/bin --exclude="share"
62
-
63
75
cd docs
64
76
rm -rf source/reference/api/_autosummary
65
- make html
77
+ if [[ "${{ needs.check_release.outputs.is_release }}" == "true" ]]; then
78
+ make html-with-notebooks
79
+ else
80
+ # Install Pandoc
81
+ PANDOC_VERSION="2.19"
82
+ curl -sLo- "https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-linux-amd64.tar.gz" | tar xzf - --strip-components 2 -C /usr/local/bin --exclude="share"
83
+ make html
84
+ fi
66
85
- name : Set up Node.js
67
86
uses : actions/setup-node@v4.0.2
68
87
with :
75
94
yarn install --frozen-lockfile
76
95
yarn build
77
96
cp -r ../build/html build/api
97
+ - name : Fetch existing gh-pages branch
98
+ if : needs.check_release.outputs.is_release != 'true'
99
+ run : |
100
+ git fetch origin github_pages:github_pages
101
+ git checkout github_pages
102
+ git checkout ${{ github.sha }} -- docs/cyclops-webpage/build
103
+ git checkout github_pages -- docs/cyclops-webpage/build/api/*.html
104
+ git checkout ${{ github.sha }}
78
105
- name : Deploy to GitHub Pages
79
106
uses : peaceiris/actions-gh-pages@v4.0.0
80
107
with :
0 commit comments