ci(gh-pages): wip #21
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: CI | |
on: | |
push: | |
branches: [ master, improve-ci ] | |
pull_request: | |
branches: [ master, improve-ci ] | |
workflow_dispatch: | |
## thanks to https://github.com/mff-cuni-cz/cuni-thesis-validator | |
jobs: | |
build: | |
name: Build PDF and upload as an artifact | |
runs-on: ubuntu-latest | |
container: { image: 'aergus/latex' } | |
steps: | |
- name: Instal git-lfs | |
run: apt-get update && apt-get install -y git-lfs | |
- name: Set up Git repository | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Build the PDF | |
run: latexmk thesis | |
- name: Upload the artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Thesis | |
path: thesis.pdf | |
verify: | |
name: Verify PDF/A | |
runs-on: ubuntu-latest | |
needs: build | |
container: { image: ghcr.io/jdujava/cuni-thesis-validator } | |
steps: | |
- name: Get the PDF file from the artifact | |
uses: actions/download-artifact@v4 | |
- name: Verify the PDF file with VeraPDF | |
run: verify Thesis/*.pdf | tee /dev/stderr | grep -qE 'nonCompliant="0" failedJobs="0"' | |
deploy: | |
name: Deploy latest build of PDF and README.md to gh-pages branch | |
if: github.event_name == 'push' # only deploy on push | |
runs-on: ubuntu-latest | |
needs: build | |
permissions: | |
contents: write | |
steps: | |
- name: Set up Git repository (to get README.md) | |
uses: actions/checkout@v4 | |
- name: Get the PDF file from the artifact | |
uses: actions/download-artifact@v4 | |
- name: Commit the PDF and README.md to `gh-pages` branch | |
run: | | |
mkdir ../gh-pages | |
cp README.md Thesis/*.pdf ../gh-pages | |
cd ../gh-pages | |
git init -b main | |
git config user.name github-actions[bot] | |
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
git remote add origin https://github.com/$GITHUB_REPOSITORY | |
git add . | |
git commit -m "[CI] Update to latest PDF and README.md" | |
git push --force origin main:gh-pages | |
# cp Thesis/*.pdf . | |
# git config user.name github-actions[bot] | |
# git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
# git add *.pdf | |
# git commit --amend --no-edit | |
# git push --force |