1010
1111jobs :
1212
13- render-book :
14- name : Render FR book
13+ render-books :
14+ name : Render books
1515 runs-on : ubuntu-20.04
1616 steps :
1717 - name : Extract branch name
@@ -60,36 +60,54 @@ jobs:
6060 run : |
6161 mkdir -p "$HOME/.local/share/fonts"
6262 cp ./fra/templates/fonts/* "$HOME/.local/share/fonts"
63+ cp ./eng/templates/fonts/* "$HOME/.local/share/fonts"
6364
6465 - name : Render PDF
6566 run : |
6667 sed -i -E "s/date: .+/date: ${{ steps.date.outputs.date }} - ${{ env.BOOK_VERSION }}/g" ./fra/metadata.yml
67- cd ./fra && make pdf
68+ sed -i -E "s/date: .+/date: ${{ steps.date.outputs.date }} - ${{ env.BOOK_VERSION }}/g" ./eng/metadata.yml
69+ cd ./fra && make pdf && cd -
70+ mv ./fra/build/pdf/book.pdf ./fra/build/pdf/book-fra.pdf
71+ cd ./eng && make pdf && cd -
72+ mv ./eng/build/pdf/book.pdf ./eng/build/pdf/book-eng.pdf
6873
6974 - name : Render HTML
7075 run : |
71- cd ./fra && make html
76+ cd ./fra && make html && cd -
77+ cd ./eng && make html && cd -
7278
7379 - uses : actions/upload-artifact@v3
7480 with :
75- name : book-pdf-${{ env.BOOK_VERSION }}
76- path : ./fra/build/pdf/book.pdf
81+ name : book-fra- pdf-${{ env.BOOK_VERSION }}
82+ path : ./fra/build/pdf/book-fra .pdf
7783 retention-days : 1
7884
7985 - uses : actions/upload-artifact@v3
8086 with :
81- name : book-html-${{ env.BOOK_VERSION }}
87+ name : book-fra- html-${{ env.BOOK_VERSION }}
8288 path : ./fra/build/html/
8389 retention-days : 1
8490
91+ - uses : actions/upload-artifact@v3
92+ with :
93+ name : book-eng-pdf-${{ env.BOOK_VERSION }}
94+ path : ./eng/build/pdf/book-eng.pdf
95+ retention-days : 1
96+
97+ - uses : actions/upload-artifact@v3
98+ with :
99+ name : book-eng-html-${{ env.BOOK_VERSION }}
100+ path : ./eng/build/html/
101+ retention-days : 1
102+
85103
86104 # Pictures in the book may be referenced at some place in the text.
87105 # Ex: \ref{fig:name} in the text to reference the \label{fig:name} illustration.
88106 #
89107 # When badly referenced, pandoc generates a double questionmarks ("??") in the place
90108 # of the latex tags. This Action checks if there are no "??" in the generated PDF.
91- check_latex_references :
92- needs : render-book
109+ check-latex-references :
110+ needs : render-books
93111 name : Check valid latex references
94112 runs-on : ubuntu-22.04
95113 steps :
@@ -115,29 +133,47 @@ jobs:
115133 exit 1
116134 fi
117135
118- - name : Download artifact
136+ - name : Download FR artifact
119137 uses : actions/download-artifact@v3
120138 with :
121- name : book-pdf-${{ env.BOOK_VERSION }}
139+ name : book-fra- pdf-${{ env.BOOK_VERSION }}
122140 path : ./
123141
124- - name : Get text from book
142+ - name : Get FR text from book
125143 run : |
126- pdftotext ./book.pdf
144+ pdftotext ./book-fra .pdf
127145
128- - name : Get text from book
146+ - name : Get FR text from book
129147 run : |
130- if grep -q "??" ./book.pdf; then
148+ if grep -q "??" ./book-fra .pdf; then
131149 echo "The file contains the string '??'"
132150 else
133151 echo "The file does not contain the string '??'"
134152 fi
135153
154+ - name : Download EN artifact
155+ uses : actions/download-artifact@v3
156+ with :
157+ name : book-eng-pdf-${{ env.BOOK_VERSION }}
158+ path : ./
159+
160+ - name : Get EN text from book
161+ run : |
162+ pdftotext ./book-eng.pdf
136163
137- check_version_change :
164+ - name : Get EN text from book
165+ run : |
166+ if grep -q "??" ./book-eng.pdf; then
167+ echo "The file contains the string '??'"
168+ else
169+ echo "The file does not contain the string '??'"
170+ fi
171+
172+
173+ check-version-change :
138174 name : " Check version change"
139175 runs-on : ubuntu-22.04
140- needs : check_latex_references
176+ needs : check-latex-references
141177 outputs :
142178 version_changed : ${{ steps.check.outputs.version_changed }}
143179 steps :
@@ -163,9 +199,9 @@ jobs:
163199 fi
164200
165201
166- deploy_to_gh_pages :
167- if : needs.check_version_change .outputs.version_changed == 'true' && (github.ref == 'refs/heads/main')
168- needs : check_version_change
202+ deploy-to-gh-pages :
203+ if : needs.check-version-change .outputs.version_changed == 'true' && (github.ref == 'refs/heads/main')
204+ needs : check-version-change
169205 runs-on : ubuntu-22.04
170206 name : Deploy to GitHub Pages
171207
@@ -191,14 +227,25 @@ jobs:
191227 - name : Download artifact
192228 uses : actions/download-artifact@v3
193229 with :
194- name : book-html-${{ env.BOOK_VERSION }}
195- path : output/
230+ name : book-fra-html-${{ env.BOOK_VERSION }}
231+ path : output/fra/
232+
233+ - name : Download artifact
234+ uses : actions/download-artifact@v3
235+ with :
236+ name : book-eng-html-${{ env.BOOK_VERSION }}
237+ path : output/eng/
196238
197239 - name : Optimize images
198240 run : |
199241 sudo apt-get install -y jpegoptim optipng
200242 find ./output/ -iname '*.jpg' -exec jpegoptim {} \; -o -iname '*.png' -exec optipng {} \;
201243
244+ - name : Copy default index files
245+ run : |
246+ cp ./index.html ./output/
247+ cp -r ./images ./output/
248+
202249 - name : Deploy to GitHub Pages
203250 uses : peaceiris/actions-gh-pages@v3
204251 with :
@@ -209,8 +256,8 @@ jobs:
209256
210257
211258 release :
212- if : needs.check_version_change .outputs.version_changed == 'true' && (github.ref == 'refs/heads/main')
213- needs : check_version_change
259+ if : needs.check-version-change .outputs.version_changed == 'true' && (github.ref == 'refs/heads/main')
260+ needs : check-version-change
214261 runs-on : ubuntu-22.04
215262 name : Generate book files for release
216263
@@ -233,18 +280,24 @@ jobs:
233280 exit 1
234281 fi
235282
236- - name : Download PDF artifact
283+ - name : Download FR PDF artifact
284+ uses : actions/download-artifact@v3
285+ with :
286+ name : book-fra-pdf-${{ env.BOOK_VERSION }}
287+ path : ./
288+
289+ - name : Download EN PDF artifact
237290 uses : actions/download-artifact@v3
238291 with :
239- name : book-pdf-${{ env.BOOK_VERSION }}
292+ name : book-eng- pdf-${{ env.BOOK_VERSION }}
240293 path : ./
241294
242295 - name : Get version
243296 id : get-version
244297 run : |
245298 VERSION_CONTENT=$(cat VERSION)
246299 echo "::set-output name=version::$VERSION_CONTENT"
247- if [[ $VERSION_CONTENT == *"-alpha"* ]]; then
300+ if [[ $VERSION_CONTENT == *"-alpha"* ]] || [[ $VERSION_CONTENT == *"-beta"* ]] || [[ $VERSION_CONTENT == *"-rc"* ]] ; then
248301 echo "::set-output name=prerelease::true"
249302 else
250303 echo "::set-output name=prerelease::false"
@@ -256,7 +309,8 @@ jobs:
256309 name : ${{ env.BOOK_VERSION }}
257310 tag_name : ${{ env.BOOK_VERSION }}
258311 files : |
259- ./book.pdf
312+ ./book-fra.pdf
313+ ./book-eng.pdf
260314 prerelease : ${{ steps.get-version.outputs.prerelease }}
261315 env :
262316 GITHUB_TOKEN : ${{ github.token }}
0 commit comments