Files
unibo-ai-notes/.github/workflows/compile.yml
2024-05-30 08:44:30 +02:00

82 lines
2.5 KiB
YAML

name: Compile LaTeX
on:
push:
branches:
- main
paths: ["src/**", .github/**, compile.sh]
jobs:
compile:
name: Compile notes
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Checkout current pdfs branch
uses: actions/checkout@v3
with:
ref: pdfs
path: .currpdfs
- name: Install LaTeX
run: |
sudo apt update
sudo apt install -y latexmk texlive texlive-science texlive-latex-extra texlive-fonts-extra texlive-bibtex-extra biber
- name: Prepare output directory
run: |
mkdir ${GITHUB_WORKSPACE}/.compiled
cp ${GITHUB_WORKSPACE}/LICENSE ${GITHUB_WORKSPACE}/.compiled
- name: Compile
run: |
bash ${GITHUB_WORKSPACE}/utils/compile.sh \
${GITHUB_WORKSPACE}/src \
${GITHUB_WORKSPACE}/.compiled \
${GITHUB_WORKSPACE}/.currpdfs
- name: Generate README
run: |
cp README.md .compiled/README.md
python3 ${GITHUB_WORKSPACE}/.github/update_readme.py \
--src-path ${GITHUB_WORKSPACE}/src \
--readme-path ${GITHUB_WORKSPACE}/.compiled/README.md \
--gh-link https://github.com/NotXia/unibo-ai-notes/blob/pdfs
- name: Move to pdfs branch
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: pdfs
FOLDER: ${GITHUB_WORKSPACE}/.compiled
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_NAME: "github-actions[bot]"
COMMIT_EMAIL: "github-actions[bot]@users.noreply.github.com"
MESSAGE: "🤖 Hello human, trying to not break anything ({sha})"
- name: Generate web viewer content
run: |
python3 ${GITHUB_WORKSPACE}/.github/prepare_web_viewer.py \
--src-path=${GITHUB_WORKSPACE}/src \
--out-path=/tmp/webviewer \
--pdfs-path=${GITHUB_WORKSPACE}/.compiled \
--template-path=${GITHUB_WORKSPACE}/.github/web-viewer \
- name: Move to pages branch
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: pages
FOLDER: /tmp/webviewer
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_NAME: "github-actions[bot]"
COMMIT_EMAIL: "github-actions[bot]@users.noreply.github.com"
MESSAGE: "🤖 Web developer stuff"