From e722de519157340307c9a73d6c8a6987f95c9869 Mon Sep 17 00:00:00 2001 From: cupcakearmy Date: Tue, 21 Feb 2023 22:58:23 +0100 Subject: [PATCH] add latex pipeline --- docs/infrastructure/github-actions/latex.md | 83 +++++++++++++++++++++ docusaurus.config.js | 3 + sidebars.js | 2 +- 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 docs/infrastructure/github-actions/latex.md diff --git a/docs/infrastructure/github-actions/latex.md b/docs/infrastructure/github-actions/latex.md new file mode 100644 index 0000000..9a69031 --- /dev/null +++ b/docs/infrastructure/github-actions/latex.md @@ -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' +``` diff --git a/docusaurus.config.js b/docusaurus.config.js index e66e816..81c0159 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -40,6 +40,9 @@ const config = { themeConfig: /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ ({ + colorMode: { + respectPrefersColorScheme: true, + }, navbar: { title: 'Memoir', items: [ diff --git a/sidebars.js b/sidebars.js index 08694d2..37e7977 100644 --- a/sidebars.js +++ b/sidebars.js @@ -1,5 +1,5 @@ const sidebars = { - tutorialSidebar: [{ type: 'autogenerated', dirName: '.' }], + main: [{ type: 'autogenerated', dirName: '.' }], } module.exports = sidebars