Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit df73d1b

Browse files
committed
github: actions to compile and deploy
1 parent 49769f1 commit df73d1b

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

.github/workflows/compile.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Compile Document and Deploy
2+
3+
permissions:
4+
contents: read
5+
pages: write
6+
id-token: write
7+
8+
on:
9+
push:
10+
branches:
11+
- master
12+
13+
jobs:
14+
compile:
15+
name: Compile LaTeX notes
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: 3.8
25+
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install -r requirements.txt
30+
31+
- name: Set up LaTeX docker and compile
32+
uses: xu-cheng/latex-action@v3
33+
with:
34+
root_file: COMP2120-Notes.tex
35+
work_in_root_file_dir: true
36+
latexmk_shell_escape: true
37+
38+
- name: Upload artifact
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: notes
42+
path: COMP2120-Notes.pdf
43+
retention-days: 1
44+
45+
build:
46+
name: Build static site
47+
runs-on: ubuntu-latest
48+
needs: compile
49+
steps:
50+
- name: Create HTML file
51+
run: |
52+
mkdir out
53+
echo "<!DOCTYPE html><html><head><title>COMP2120 Notes</title><meta http-equiv='refresh' content='0;url=COMP2120-Notes.pdf'></head><body><a href="COMP2120-Notes.pdf">Download Notes</a></body></html>" > out/index.html
54+
55+
- name: Download artifact
56+
uses: actions/download-artifact@v4
57+
with:
58+
name: notes
59+
path: out
60+
merge-multiple: true
61+
62+
- name: Upload static files as artifact
63+
id: deployment
64+
uses: actions/upload-pages-artifact@v3
65+
with:
66+
path: out
67+
68+
deploy:
69+
name: Deploy static site
70+
runs-on: ubuntu-latest
71+
needs: build
72+
environment:
73+
name: github-pages
74+
url: ${{ steps.deployment.outputs.page_url }}
75+
steps:
76+
- name: Deploy to GitHub Pages
77+
uses: actions/deploy-pages@v3
78+

requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
latex2pydata==0.4.1
2+
latexminted==0.4.0
3+
latexrestricted==0.6.2
4+
Pygments==2.19.1

0 commit comments

Comments
 (0)