Skip to content

Commit

Permalink
ci: auto-generate pdf file + release
Browse files Browse the repository at this point in the history
Workflow I used in my thesis
  • Loading branch information
jy95 committed May 19, 2020
1 parent a70dfa1 commit fbd5654
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/build-pdf.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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 }}

0 comments on commit fbd5654

Please sign in to comment.