@@ -3,227 +3,106 @@ name: Update Documentation
33on :
44 workflow_dispatch :
55 inputs :
6- tag :
7- description : Release tag (e.g. selenium- 4.21.0)
6+ version :
7+ description : Release version (e.g., 4.21.0)
88 required : true
99 type : string
10+ language :
11+ description : language documentation
12+ required : true
13+ type : choice
14+ default : " all"
15+ options :
16+ - java
17+ - rb
18+ - py
19+ - dotnet
20+ - node
21+ - all
1022
1123 workflow_call :
1224 inputs :
13- tag :
25+ version :
26+ required : true
27+ type : string
28+ sha :
1429 required : true
1530 type : string
31+ language :
32+ required : false
33+ type : string
34+ default : " all"
1635
1736env :
1837 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
1938
2039jobs :
21- determine-language :
40+ determine-languages :
2241 runs-on : ubuntu-latest
2342 outputs :
24- language : ${{ steps.get-language .outputs.language }}
43+ matrix : ${{ steps.set-matrix .outputs.matrix }}
2544 steps :
26- - name : Parse language from tag
27- id : get-language
45+ - id : set-matrix
2846 run : |
29- tag= ${{ inputs.tag }}
30- language=$(echo $tag | awk -F'-' '{print $NF}')
31- if [[ ! "$language" =~ ^(java|ruby|python|dotnet|node)$ ]]; then
32- language="all"
47+ if [ " ${{ inputs.language }}" == "all" ]; then
48+ echo 'matrix={"language":["java","rb","py","dotnet","node"]}' >> $GITHUB_OUTPUT
49+ else
50+ echo 'matrix={"language":["${{ inputs.language }}"]}' >> $GITHUB_OUTPUT
3351 fi
34- echo "language=$language" > $GITHUB_OUTPUT
35-
36- java-docs :
52+ build-docs :
53+ needs : determine-languages
3754 runs-on : ubuntu-latest
38- needs : determine-language
55+ strategy :
56+ matrix : ${{ fromJson(needs.determine-languages.outputs.matrix) }}
57+ fail-fast : false
3958 steps :
40- - name : Checkout the tag
59+ - name : Checkout repository
4160 uses : actions/checkout@v4
4261 with :
43- ref : ${{ inputs.tag }}
44- - name : Prep git
45- run : |
46- git config --local user.email "[email protected] " 47- git config --local user.name "Selenium CI Bot"
48- - name : Setup Java
49- uses : actions/setup-java@v4
50- with :
51- java-version : 17
52- distribution : ' temurin'
53- - name : Update Documentation
54- if : needs.determine-language.outputs.language == 'all' || needs.determine-language.outputs.language == 'java'
55- run : ./go java:docs
56- - name : Create patch for changes
57- run : |
58- git format-patch -1 HEAD --stdout > java-docs.patch
59- - name : Upload patch
60- if : needs.determine-language.outputs.language == 'all' || needs.determine-language.outputs.language == 'java'
61- uses : actions/upload-artifact@v4
62- with :
63- name : java-docs-patch
64- path : java-docs.patch
65-
66- ruby-docs :
67- runs-on : ubuntu-latest
68- needs : determine-language
69- steps :
70- - name : Checkout the tag
71- uses : actions/checkout@v4
72- with :
73- ref : ${{ inputs.tag }}
74- - name : Prep git
62+ ref : ${{ github.event_name == 'workflow_dispatch' && github.ref || inputs.sha }}
63+ - name : Fetch gh-pages branch
64+ run : git fetch origin gh-pages
65+ - name : Setup git
7566 run : |
7667 git config --local user.email "[email protected] " 7768 git config --local user.name "Selenium CI Bot"
69+ - name : Setup curl for Ubuntu
70+ run : sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev
7871 - name : Setup Java
7972 uses : actions/setup-java@v4
8073 with :
8174 java-version : 17
8275 distribution : ' temurin'
83- - name : Setup curl for Ubuntu
84- run : sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev
85- - name : Update Documentation
86- if : needs.determine-language.outputs.language == 'all' || needs.determine-language.outputs.language == 'ruby'
87- run : ./go rb:docs
88- - name : Create patch for changes
89- run : |
90- git format-patch -1 HEAD --stdout > ruby-docs.patch
91- - name : Upload patch
92- if : needs.determine-language.outputs.language == 'all' || needs.determine-language.outputs.language == 'ruby'
93- uses : actions/upload-artifact@v4
94- with :
95- name : ruby-docs-patch
96- path : ruby-docs.patch
97-
98- python-docs :
99- needs : determine-language
100- runs-on : ubuntu-latest
101- steps :
102- - name : Checkout the tag
103- uses : actions/checkout@v4
104- with :
105- ref : ${{ inputs.tag }}
106- - name : Prep git
107- run : |
108- git config --local user.email "[email protected] " 109- git config --local user.name "Selenium CI Bot"
11076 - name : Set up Python 3.9
77+ if : ${{ matrix.language == 'py' }}
11178 uses : actions/setup-python@v5
11279 with :
11380 python-version : 3.9
11481 - name : Install dependencies
82+ if : ${{ matrix.language == 'py' }}
11583 run : |
11684 python -m pip install --upgrade pip
11785 pip install tox
118- - name : Update Documentation
119- if : needs.determine-language.outputs.language == 'all' || needs.determine-language.outputs.language == 'python'
120- run : ./go py:docs
121- - name : Create patch for changes
122- run : |
123- git format-patch -1 HEAD --stdout > python-docs.patch
124- - name : Upload patch
125- if : needs.determine-language.outputs.language == 'all' || needs.determine-language.outputs.language == 'python'
126- uses : actions/upload-artifact@v4
127- with :
128- name : python-docs-patch
129- path : python-docs.patch
130-
131- dotnet-docs :
132- needs : determine-language
133- runs-on : ubuntu-latest
134- steps :
135- - name : Checkout the tag
136- uses : actions/checkout@v4
137- with :
138- ref : ${{ inputs.tag }}
139- - name : Prep git
140- run : |
141- git config --local user.email "[email protected] " 142- git config --local user.name "Selenium CI Bot"
143- - name : Update Documentation
144- if : needs.determine-language.outputs.language == 'all' || needs.determine-language.outputs.language == 'dotnet'
145- run : ./go dotnet:docs
146- - name : Create patch for changes
147- run : |
148- git format-patch -1 HEAD --stdout > dotnet-docs.patch
149- - name : Upload patch
150- if : needs.determine-language.outputs.language == 'all' || needs.determine-language.outputs.language == 'dotnet'
151- uses : actions/upload-artifact@v4
152- with :
153- name : dotnet-docs-patch
154- path : dotnet-docs.patch
155-
156- node-docs :
157- needs : determine-language
158- runs-on : ubuntu-latest
159- steps :
160- - name : Checkout the tag
161- uses : actions/checkout@v4
162- with :
163- ref : ${{ inputs.tag }}
164- - name : Prep git
165- run : |
166- git config --local user.email "[email protected] " 167- git config --local user.name "Selenium CI Bot"
16886 - name : Install npm dependencies
87+ if : ${{ matrix.language == 'node' }}
16988 run : |
17089 npm install
17190 npm install --prefix javascript/node/selenium-webdriver
17291 - name : Update Documentation
173- if : needs.determine-language.outputs.language == 'all' || needs.determine-language.outputs.language == 'node'
174- run : ./go node:docs
175- - name : Create patch for changes
176- run : |
177- git format-patch -1 HEAD --stdout > node-docs.patch
178- - name : Upload patch
179- if : needs.determine-language.outputs.language == 'all' || needs.determine-language.outputs.language == 'node'
180- uses : actions/upload-artifact@v4
181- with :
182- name : node-docs-patch
183- path : node-docs.patch
184-
185- merge-patches :
186- runs-on : ubuntu-latest
187- needs : [java-docs, ruby-docs, python-docs, dotnet-docs, node-docs]
188- steps :
189- - name : Checkout documentation branch
190- uses : actions/checkout@v4
191- with :
192- ref : ' gh-pages'
193- fetch-depth : 0
194- fetch-tags : true
195- - name : Create and checkout new branch
196- run : |
197- git config --local user.email "[email protected] " 198- git config --local user.name "Selenium CI Bot"
199- git checkout -b api-docs-${{ inputs.tag }}
200- - name : Download all patches
201- uses : actions/download-artifact@v4
202- with :
203- path : patches/
204- merge-multiple : true
205- - name : Show downloaded patches
206- run : ls -lah patches/
207- - name : Apply patches
208- run : |
209- for patch in patches/*.patch; do
210- git am < "$patch"
211- done
212- rm -rf patches/
213- - name : Push Branch
214- run : git push origin api-docs-${{ inputs.tag }}
92+ run : ./go ${{ matrix.language }}:docs
21593 - name : Documentation Pull Request
21694 uses : peter-evans/create-pull-request@v6
21795 with :
21896 token : ${{ secrets.SELENIUM_CI_TOKEN }}
21997 author :
Selenium CI Bot <[email protected] > 22098 delete-branch : true
221- branch : api-docs-${{ inputs.tag }}
99+ branch : api-docs-${{ inputs.version }}-${{ matrix.language }}
222100 base : gh-pages
223- title : Update documentation for ${{ inputs.tag }}
101+ add-paths : |
102+ ${{ matrix.language == 'node' && 'docs/api/javascript/**' || format('docs/api/{0}/**', matrix.language) }}
103+ title : Update documentation for Selenium ${{ inputs.version }} (${{ matrix.language }})
224104 body : |
225- This PR updates the API documentation for all bindings
226- based on the provided tag name.
105+ This PR updates the API documentation for **${{ matrix.language }}** language bindings to version **${{ inputs.version }}**.
227106
228107 - Auto-generated by [create-pull-request][1]
229108
0 commit comments