@@ -3,95 +3,60 @@ name: docs
33on :
44 push :
55 branches :
6- - master
7- # pull_request:
8- # branches:
9- # - master
10-
11- defaults :
12- run :
13- shell : bash -l {0}
6+ - main
7+ tags :
8+ - ' v*'
9+ pull_request :
10+ branches :
11+ - main
1412
1513jobs :
1614 build :
1715 name : build and deploy docs
18- runs-on : windows -latest
16+ runs-on : ubuntu -latest
1917 steps :
20-
2118 - uses : actions/checkout@v2
2219
23- -
uses :
conda-incubator/[email protected] 20+ -
uses :
compas-dev/[email protected] 21+ id : docs
2422 with :
25- miniconda-version : " latest"
26- activate-environment : cgal
27- channels : conda-forge
28- python-version : 3.7
29-
30- - name : build (windows)
31- run : |
32- conda install eigen boost-cpp mpir mpfr cgal-cpp">=5.0" pybind11 COMPAS">=0.16.0" -y
33- pip install -r requirements-dev.txt
34-
35- - name : Generate docs
36- if : ${{ success() }}
37- run : |
38- invoke docs
39- # Get branch/tag/latest name from git
40- GITHUB_REF_REGEX="tags/v[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}|(pull/[0-9]+)|heads/master"
41- if [[ $GITHUB_REF =~ $GITHUB_REF_REGEX ]]; then
42- if [[ $BASH_REMATCH = pull* ]]; then
43- echo This is a pull request
44- FOLDER_NAME=pull_${BASH_REMATCH##*/}
45- elif [[ $BASH_REMATCH = tags/* ]]; then
46- echo This is a version tag
47- FOLDER_NAME=${BASH_REMATCH##*/v}
48- else
49- echo This is a commit to master branch
50- FOLDER_NAME=latest
51- fi;
52- fi;
53- echo "Docs will be deployed to https://compas.dev/compas_cgal/$FOLDER_NAME"
54- mkdir -p deploy/$BRANCH_OR_TAG && mv -T dist/docs deploy/$FOLDER_NAME/
23+ dest : deploy
24+ build_to_subfolder : true
5525
5626 - name : Deploy docs
57- if : success()
27+ if : success() && steps.docs.outputs.commit_type != 'pull'
5828 uses : crazy-max/ghaction-github-pages@v2
5929 with :
6030 target_branch : gh-pages
6131 build_dir : deploy
6232 keep_history : true
6333 env :
6434 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
65-
35+
36+ outputs :
37+ commit_type : ${{ steps.docs.outputs.commit_type }}
38+ current_version : ${{ steps.docs.outputs.current_version }}
39+
6640 docVersions :
6741 needs : build
42+ if : needs.build.outputs.commit_type == 'tag'
6843 name : update doc versions
6944 runs-on : ubuntu-latest
7045 steps :
71-
7246 - uses : actions/checkout@v2
7347 with :
7448 ref : gh-pages
7549
76- - name : update doc versions
77- run : |
78- >doc_versions.txt
79- for folder in $(ls -rd */ | tr -d '/')
80- do
81- if [[ $folder =~ ^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$|^latest$ ]]
82- then
83- echo ${folder} >> doc_versions.txt
84- fi
85- done
86- echo found available doc versions:
87- cat doc_versions.txt
50+ -
uses :
compas-dev/[email protected] 51+ with :
52+ current_version : ${{ needs.build.outputs.current_version }}
8853
8954 - name : Deploy docs
9055 if : success()
9156 uses : crazy-max/ghaction-github-pages@v2
9257 with :
9358 target_branch : gh-pages
9459 build_dir : ./
95- keep_history : false
60+ keep_history : false
9661 env :
97- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
62+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments