Justified paragraphs for html version #208
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Render PDF book | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
branches: | |
- develop | |
- staging | |
jobs: | |
render-pdf-fr: | |
name: Render FR PDF book | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Extract branch name | |
if: github.event_name != 'pull_request' | |
shell: bash | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV | |
id: extract_branch | |
- name: Extract branch name on pull request | |
if: github.event_name == 'pull_request' | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF})" >> $GITHUB_ENV | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Get version | |
run: | | |
version=$(cat ./VERSION) | |
version=${version##+( )} # Trim left whitespaces | |
version=${version%%+( )} # Trim right whitespaces | |
echo "BOOK_VERSION=$version" >> $GITHUB_ENV | |
echo "version : $version" | |
- name: Checking version format | |
run: | | |
if ! [[ $BOOK_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+(-(alpha|beta|rc)(-[0-9]+)?)?$ ]] | |
then | |
echo "Invalid version format. Check your ./VERSION file." | |
exit 1 | |
fi | |
- name: Get current date | |
id: date | |
run: echo "::set-output name=date::$(date +'%B %Y')" | |
- name: Install pandoc | |
run: | | |
wget https://github.com/jgm/pandoc/releases/download/2.9.2.1/pandoc-2.9.2.1-1-amd64.deb | |
sudo dpkg -i pandoc-2.9.2.1-1-amd64.deb | |
sudo apt-get update && sudo apt-get install -y make texlive texlive-xetex texlive-latex-extra texlive-fonts-recommended | |
- name: Install pdftk | |
run: | | |
sudo apt-get update && sudo apt-get install -y pdftk | |
sudo sed -i '/disable ghostscript format types/,+6d' /etc/ImageMagick-6/policy.xml | |
- name: Render PDF | |
run: | | |
sed -i -E "s/date: Undefined/date: ${{ steps.date.outputs.date }} - ${{ env.BOOK_VERSION }}/g" ./fra/metadata.yml | |
cd ./fra && make pdf | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: book-${{ env.BOOK_VERSION }} | |
path: ./fra/build/pdf/book.pdf | |
# Pictures in the book may be referenced at some place in the text. | |
# Ex: \ref{fig:name} in the text to reference the \label{fig:name} illustration. | |
# | |
# When badly referenced, pandoc generates a double questionmarks ("??") in the place | |
# of the latex tags. This Action checks if there are no "??" in the generated PDF. | |
check_picture_references: | |
needs: render-pdf-fr | |
name: Check valid latex references for pictures | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Install poppler-utils | |
run: | | |
sudo apt-get update && sudo apt-get install -y poppler-utils | |
- name: Get version | |
run: | | |
version=$(cat ./VERSION) | |
version=${version##+( )} # Trim left whitespaces | |
version=${version%%+( )} # Trim right whitespaces | |
echo "BOOK_VERSION=$version" >> $GITHUB_ENV | |
echo "version : $version" | |
- name: Checking version format | |
run: | | |
if ! [[ $BOOK_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+(-(alpha|beta|rc)(-[0-9]+)?)?$ ]] | |
then | |
echo "Invalid version format. Check your ./VERSION file." | |
exit 1 | |
fi | |
- name: Download artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: book-${{ env.BOOK_VERSION }} | |
path: ./ | |
- name: Get text from book | |
run: | | |
pdftotext ./book.pdf | |
- name: Get text from book | |
run: | | |
if grep -q "??" ./book.pdf; then | |
echo "The file contains the string '??'" | |
else | |
echo "The file does not contain the string '??'" | |
fi |