Skip to content

Commit c86b80a

Browse files
lissy93claude
andcommitted
🪁 Add PDF generation to website build workflow
- Update build-site.yml to generate CV PDF during website build - Fix PDF filename handling (Makefile outputs Alicia-Sykes-CV.pdf, renamed to alicia-sykes-cv.pdf for web) - Update download page to serve PDF directly from website with GitHub fallback - Add comprehensive error handling and verification steps for PDF generation - PDF now available at /alicia-sykes-cv.pdf on deployed website 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 4708430 commit c86b80a

2 files changed

Lines changed: 89 additions & 18 deletions

File tree

.github/workflows/build-site.yml

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,52 @@ jobs:
3737
cache: 'npm'
3838
cache-dependency-path: 'web/package-lock.json'
3939

40-
- name: Install dependencies
40+
- name: Setup Python
41+
uses: actions/setup-python@v5
42+
with:
43+
python-version: '3.11'
44+
cache: 'pip'
45+
cache-dependency-path: 'lib/requirements.txt'
46+
47+
- name: Install LaTeX
48+
run: |
49+
sudo apt-get update
50+
sudo apt-get install -y texlive-xetex texlive-fonts-recommended texlive-fonts-extra
51+
52+
- name: Install Python dependencies
53+
run: |
54+
pip install -r lib/requirements.txt
55+
56+
- name: Generate PDF
57+
run: |
58+
set +e # Don't fail workflow if PDF generation fails
59+
60+
echo "🔄 Generating PDF from CV data..."
61+
62+
# Create output directory
63+
mkdir -p out
64+
65+
# Generate LaTeX from template
66+
if python lib/generate.py --resume resume.yml --template template.jinja --output tex/resume.tex; then
67+
echo "✅ LaTeX template generated successfully"
68+
69+
# Compile LaTeX to PDF
70+
if python lib/compile.py --input tex/resume.tex --output out/Alicia-Sykes-CV.pdf; then
71+
echo "✅ PDF generated successfully"
72+
ls -la out/Alicia-Sykes-CV.pdf
73+
echo "PDF_GENERATED=true" >> $GITHUB_ENV
74+
else
75+
echo "❌ PDF compilation failed, but continuing with website build"
76+
echo "PDF_GENERATED=false" >> $GITHUB_ENV
77+
fi
78+
else
79+
echo "❌ LaTeX generation failed, but continuing with website build"
80+
echo "PDF_GENERATED=false" >> $GITHUB_ENV
81+
fi
82+
83+
set -e # Re-enable exit on error
84+
85+
- name: Install web dependencies
4186
run: |
4287
cd web
4388
npm ci
@@ -48,16 +93,35 @@ jobs:
4893
run: |
4994
cd web
5095
npm run build
96+
97+
# Copy generated PDF to web build directory with correct naming
98+
if [ -f "../out/Alicia-Sykes-CV.pdf" ]; then
99+
cp "../out/Alicia-Sykes-CV.pdf" "build/alicia-sykes-cv.pdf"
100+
echo "✅ PDF copied to website build as alicia-sykes-cv.pdf"
101+
elif [ -f "../out/alicia-sykes-cv.pdf" ]; then
102+
cp "../out/alicia-sykes-cv.pdf" "build/"
103+
echo "✅ PDF copied to website build"
104+
else
105+
echo "⚠️ PDF not found, skipping copy to website"
106+
fi
51107
52108
- name: Verify build output
53109
run: |
54110
cd web
55111
if [ -f "build/index.html" ]; then
56112
echo "✅ Static site built successfully"
57113
echo "Build directory contains:"
58-
ls -la build/ | head -10
114+
ls -la build/ | head -15
115+
echo ""
59116
echo "Build size:"
60117
du -sh build/
118+
echo ""
119+
if [ -f "build/alicia-sykes-cv.pdf" ]; then
120+
echo "✅ PDF available in website build"
121+
ls -lh build/alicia-sykes-cv.pdf
122+
else
123+
echo "⚠️ PDF not found in website build"
124+
fi
61125
else
62126
echo "❌ Build failed - no index.html found in build directory"
63127
exit 1

web/src/routes/download/+page.svelte

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,31 @@
88
onMount(async () => {
99
if (browser) {
1010
try {
11-
const repoOwner = 'Lissy93';
12-
const repoName = 'cv';
13-
const assetName = 'Alicia-Sykes-CV.pdf';
14-
15-
// Fetch the latest release data from GitHub API
16-
const response = await fetch(`https://api.github.com/repos/${repoOwner}/${repoName}/releases/latest`);
17-
if (!response.ok) {
18-
throw new Error('Failed to fetch release info');
19-
}
11+
// Try to download the PDF directly from the website
12+
const pdfUrl = '/alicia-sykes-cv.pdf';
13+
14+
// Check if the PDF exists
15+
const response = await fetch(pdfUrl, { method: 'HEAD' });
16+
if (response.ok) {
17+
// PDF exists, redirect to it
18+
window.location.href = pdfUrl;
19+
} else {
20+
// Fallback to GitHub releases
21+
const repoOwner = 'Lissy93';
22+
const repoName = 'cv';
23+
const assetName = 'Alicia-Sykes-CV.pdf';
2024
21-
const release = await response.json();
22-
const tagName = release.tag_name;
25+
const releaseResponse = await fetch(`https://api.github.com/repos/${repoOwner}/${repoName}/releases/latest`);
26+
if (!releaseResponse.ok) {
27+
throw new Error('Failed to fetch release info');
28+
}
2329
24-
// Construct the download URL and redirect
25-
const downloadUrl = `https://github.com/${repoOwner}/${repoName}/releases/download/${tagName}/${assetName}`;
26-
27-
// Redirect to download
28-
window.location.href = downloadUrl;
30+
const release = await releaseResponse.json();
31+
const tagName = release.tag_name;
32+
const downloadUrl = `https://github.com/${repoOwner}/${repoName}/releases/download/${tagName}/${assetName}`;
33+
34+
window.location.href = downloadUrl;
35+
}
2936
} catch (err) {
3037
console.error('Download error:', err);
3138
error = true;

0 commit comments

Comments
 (0)