add latex pipeline

This commit is contained in:
cupcakearmy 2023-02-21 22:58:23 +01:00
parent 67aca792cf
commit e722de5191
No known key found for this signature in database
GPG Key ID: 3235314B4D31232F
3 changed files with 87 additions and 1 deletions

View File

@ -0,0 +1,83 @@
---
tags:
- LaTeX
- Github Actions
- CD
- Pipeline
- Tectonic
---
# Building LaTeX in Github Actions
This pipeline uses [tectonic](https://tectonic-typesetting.github.io) as the build system for LaTeX. Covered here are:
- Custom fonts
- Pipeline
- Upload generated files as artifacts
## Fonts
If we are using custom fonts, we need to make them available first. This means checking them into the repo (or downloading them remotely). In this case I chose storing them as LFS files.
In most Linux systems you can install custom fonts under `~/.fonts`.
```
./fonts/
├── Open_Sans.zip
├── Roboto_Mono.zip
└── install.sh
```
```sh
#!/bin/sh
TARGET=~/.fonts
mkdir -p $TARGET
unzip -o -d "$TARGET/roboto_mono" "./fonts/Roboto_Mono.zip"
unzip -o -d "$TARGET/open_sans" "./fonts/Open_Sans.zip"
```
## Pipeline
```yaml
name: 'Build LaTeX'
on:
pull_request:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Optional Cache of downloaded Tex packages
- uses: actions/cache@v3
name: Tectonic Cache
with:
path: ~/.cache/Tectonic
key: ${{ runner.os }}-tectonic-${{ hashFiles('**/*.tex') }}
restore-keys: |
${{ runner.os }}-tectonic-
# Install tectonic
- uses: wtfjoke/setup-tectonic@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install fonts
run: ./fonts/install.sh
- name: Build
run: tectonic src/main.tex
- name: Upload PDFs
uses: actions/upload-artifact@v2
with:
name: PDFs
path: '*.pdf'
```

View File

@ -40,6 +40,9 @@ const config = {
themeConfig: themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */ /** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({ ({
colorMode: {
respectPrefersColorScheme: true,
},
navbar: { navbar: {
title: 'Memoir', title: 'Memoir',
items: [ items: [

View File

@ -1,5 +1,5 @@
const sidebars = { const sidebars = {
tutorialSidebar: [{ type: 'autogenerated', dirName: '.' }], main: [{ type: 'autogenerated', dirName: '.' }],
} }
module.exports = sidebars module.exports = sidebars