-
Notifications
You must be signed in to change notification settings - Fork 3
114 lines (114 loc) · 3.92 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: CI
on: [push, pull_request]
jobs:
build:
name: Build LaTeX
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Install dependencies
run: |
sudo apt update || true
sudo apt --yes --no-install-recommends install texlive texlive-fonts-extra texlive-lang-german texlive-latex-extra texlive-plain-generic latexmk
- name: Build LaTeX presentation
run: |
cd presentation/latex
latexmk -pdf presentation.tex
- name: Upload presentation
uses: actions/upload-artifact@v3
with:
name: presentation
path: presentation/latex/presentation.pdf
- name: Build report
run: |
cd report
latexmk -pdf report.tex
- name: Upload report
uses: actions/upload-artifact@v3
with:
name: report
path: report/report.pdf
- name: Build thesis
run: |
cd thesis
latexmk -pdf thesis.tex
- name: Upload thesis
uses: actions/upload-artifact@v3
with:
name: thesis
path: thesis/thesis.pdf
build-typst:
name: Build Typst
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Install dependencies
run: |
sudo apt update || true
sudo apt --yes --no-install-recommends install wget xz-utils
wget https://github.com/typst/typst/releases/download/v0.11.1/typst-x86_64-unknown-linux-musl.tar.xz
tar xf typst-x86_64-unknown-linux-musl.tar.xz
sudo cp typst-x86_64-unknown-linux-musl/typst /usr/bin
- name: Build LaTeX presentation
run: |
cd presentation/typst
typst compile presentation.typ
publish:
name: Publish
needs: build
runs-on: ubuntu-22.04
permissions:
contents: write
if: ${{ github.ref == 'refs/heads/master' }}
timeout-minutes: 30
steps:
- name: Checkout gh-pages
uses: actions/checkout@v3
with:
ref: gh-pages
path: pages
- name: Install dependencies
run: |
sudo apt update || true
sudo apt --yes --no-install-recommends install ghostscript imagemagick
- name: Allow PDF conversions
# FIXME Ubuntu has blocked PDF conversions in ImageMagick for security reasons
run: |
sudo sed --in-place '/disable ghostscript format types/,+6d' /etc/ImageMagick-6/policy.xml
- name: Download presentation
uses: actions/download-artifact@v3
with:
name: presentation
path: pages
- name: Download report
uses: actions/download-artifact@v3
with:
name: report
path: pages
- name: Download thesis
uses: actions/download-artifact@v3
with:
name: thesis
path: pages
- name: Create thumbnails
run: |
convert -colorspace sRGB -density 300 -thumbnail 1920x1920 -quality 90 -background white -alpha remove -alpha off 'pages/presentation.pdf[0]' pages/presentation.png
convert -colorspace sRGB -density 300 -thumbnail 1920x1920 -quality 90 -background white -alpha remove -alpha off 'pages/report.pdf[0]' pages/report.png
convert -colorspace sRGB -density 300 -thumbnail 1920x1920 -quality 90 -background white -alpha remove -alpha off 'pages/thesis.pdf[0]' pages/thesis.png
touch pages/.nojekyll
- name: Commit preview
run: |
cd pages
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add --all .
git commit --amend --reset-author --message='Previews for ${{ github.sha }}'
git push --force