Skip to content

Commit 8e67ad0

Browse files
Copilothifly81
andcommitted
Add GitHub Actions workflow for PDF generation on release
Co-authored-by: hifly81 <[email protected]>
1 parent c9b7e28 commit 8e67ad0

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Generate PDFs on Release
2+
3+
on:
4+
release:
5+
types: [created, published]
6+
7+
jobs:
8+
generate-pdfs:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: '3.11'
19+
20+
- name: Install dependencies
21+
run: |
22+
sudo apt-get update
23+
sudo apt-get install -y pandoc texlive-xetex texlive-fonts-recommended texlive-plain-generic
24+
pip install jupyter nbconvert
25+
26+
- name: Convert notebooks to PDF
27+
run: |
28+
mkdir -p pdfs
29+
for notebook in *.ipynb; do
30+
echo "Converting $notebook to PDF..."
31+
jupyter nbconvert --to pdf "$notebook" --output-dir=pdfs
32+
done
33+
34+
- name: Upload PDFs to release
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
run: |
38+
for pdf in pdfs/*.pdf; do
39+
echo "Uploading $pdf to release..."
40+
gh release upload ${{ github.event.release.tag_name }} "$pdf" --clobber
41+
done

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,7 @@ server/node_modules
2727
server/package-lock.json
2828

2929
.ipynb_checkpoints/
30+
31+
# PDF files (generated by CI/CD)
32+
*.pdf
33+
pdfs/

0 commit comments

Comments
 (0)