diff --git a/.github/workflows/build-pdf.yml b/.github/workflows/build-pdf.yml new file mode 100644 index 0000000..9cf741d --- /dev/null +++ b/.github/workflows/build-pdf.yml @@ -0,0 +1,60 @@ +name: Build LaTeX document +# Trigger the workflow on push or pull request +on: [push, pull_request] +env: + FINAL_FILENAME: Yakoub_13861700_2020.pdf + MAIN_LATEX: thesis.tex + DATE_TIMEZONE: Europe/Brussels + +jobs: + build_latex: + runs-on: ubuntu-latest + steps: + - name: Set up Git repository + uses: actions/checkout@v2 + - name: Extract filename from ${{ env.MAIN_LATEX }} + run: | + echo "::set-env name=MAIN_FILENAME::$(echo ${{ env.MAIN_LATEX }} | sed 's/\.[^.]*$//')" + - name: Compile LaTeX document + uses: xu-cheng/latex-action@v2 + with: + root_file: ${{ env.MAIN_LATEX }} + - name: rename ${{ env.MAIN_FILENAME }}.pdf to ${{ env.FINAL_FILENAME }} + run: | + mv "${{ env.MAIN_FILENAME }}.pdf" "${{ env.FINAL_FILENAME }}" + - name: Upload result file + uses: actions/upload-artifact@v2 + with: + name: ${{ env.FINAL_FILENAME }} + path: ${{ env.FINAL_FILENAME }} + release_latex: + runs-on: ubuntu-latest + needs: build_latex + if: github.ref == 'refs/heads/master' + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - uses: actions/download-artifact@v2 + with: + name: ${{ env.FINAL_FILENAME }} +# See : https://github.com/actions/download-artifact/issues/14 + - name: Restore permissions + run: | + chmod -R 777 ${{ env.FINAL_FILENAME }} + - name: Set timezone for date + run: | + sudo timedatectl set-timezone ${{ env.DATE_TIMEZONE }} + - name: Get current date + run: echo "::set-env name=CURRENT_DATETIME::$(date +'%d/%m/%Y %H:%M:%S')" + - name: Generate version number + run: echo "::set-env name=CURRENT_VERSION::$(date +'%d%m%Y_%H-%M-%S')" + - name: Upload result file into releases + uses: Xotl/cool-github-releases@v1.1.2 + with: + mode: update + tag_name: ${{ env.CURRENT_VERSION }} + release_name: PDF - ${{ env.CURRENT_DATETIME }} + replace_assets: true + assets: ${{ env.FINAL_FILENAME }} + initial_mrkdwn: Release auto-generated by Github Actions 🎉 + github_token: ${{ github.token }} \ No newline at end of file