5
5
on :
6
6
workflow_dispatch :
7
7
inputs :
8
- deploy-gh-pages :
9
- description : Deploy GH Pages
10
- required : true
11
- type : boolean
12
- default : false
13
8
khiops-python-tutorial-revision :
14
9
default : main
15
10
description : khiops-python-tutorial repo revision
24
19
- doc/*.py
25
20
- khiops/**.py
26
21
- .github/workflows/api-docs.yml
22
+ push :
23
+ tags : ['*']
27
24
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
28
25
permissions :
29
26
contents : read
@@ -49,20 +46,10 @@ jobs:
49
46
# https://github.com/actions/runner/issues/2033#issuecomment-1598547465
50
47
options : --user 1001
51
48
steps :
52
- - name : Set parameters as env
53
- run : |
54
- KHIOPS_PYTHON_TUTORIAL_REVISION=${{ inputs.khiops-python-tutorial-revision || env.DEFAULT_KHIOPS_PYTHON_TUTORIAL_REVISION }}
55
- echo "KHIOPS_PYTHON_TUTORIAL_REVISION=$KHIOPS_PYTHON_TUTORIAL_REVISION" >> "$GITHUB_ENV"
56
49
- name : Checkout khiops-python
57
50
uses : actions/checkout@v4
58
51
with :
59
52
fetch-depth : 0
60
- - name : Checkout khiops-python-tutorial
61
- uses : actions/checkout@v4
62
- with :
63
- repository : khiopsml/khiops-python-tutorial
64
- ref : ${{ env.KHIOPS_PYTHON_TUTORIAL_REVISION }}
65
- path : doc/khiops-python-tutorial
66
53
- name : Add pip scripts directory to path
67
54
run : echo PATH="$PATH:/github/home/.local/bin" >> "$GITHUB_ENV"
68
55
- name : Install doc build requirements
@@ -75,25 +62,43 @@ jobs:
75
62
# Install the doc python requirements
76
63
cd doc
77
64
pip3 install -U -r requirements.txt
65
+ # Clone the Khiops Python tutorial repository while building the documentation
78
66
- name : Build Sphinx Documentation
79
67
run : |
80
68
cd doc
81
- ./create-doc -t
69
+ ./create-doc -t -d -g \
70
+ ${{ inputs.khiops-python-tutorial-revision || env.DEFAULT_KHIOPS_PYTHON_TUTORIAL_REVISION }}
82
71
- name : Upload the docs as an artifact
83
- uses : actions/upload-pages- artifact@v3
72
+ uses : actions/upload-artifact@v4
84
73
with :
85
- path : doc/_build/html/
86
- # Deploy only when the user explicitly (and manually) orders it
87
- deploy :
88
- if : github.event_name == 'workflow_dispatch' && inputs.deploy-gh-pages == true
89
- runs-on : ubuntu-latest
74
+ name : api-docs
75
+ path : ./doc/_build/html/
76
+ # Release on Git tag
77
+ release :
78
+ if : github.ref_type == 'tag'
90
79
needs : build
91
- environment :
92
- name : github-pages
93
- url : ${{ steps.deployment.outputs.page_url }}
80
+ runs-on : ubuntu-22.04
81
+ permissions :
82
+ contents : write
94
83
steps :
95
- - name : Setup Pages
96
- uses : actions/configure-pages@v4
97
- - name : Deploy API Docs to GitHub Pages
98
- id : deployment
99
- uses : actions/deploy-pages@v4
84
+ - name : Download docs artifact
85
+ uses : actions/download-artifact@v4
86
+ with :
87
+ name : api-docs
88
+ path : ./doc/_build/html/
89
+ - name : Create docs release zip archive
90
+ uses : thedoctor0/zip-release@0.7.6
91
+ with :
92
+ type : zip
93
+ path : ./doc/_build/html/
94
+ filename : khiops-api-docs-${{ github.ref_name }}.zip
95
+ - name : Release the docs zip archive
96
+ uses : ncipollo/release-action@v1.15.0
97
+ with :
98
+ allowUpdates : true
99
+ artifacts : ./khiops-api-docs-${{ github.ref_name }}.zip
100
+ body : ' **For testing purposes only**'
101
+ draft : false
102
+ makeLatest : false
103
+ prerelease : true
104
+ updateOnlyUnreleased : true
0 commit comments