Skip to content

Compile and Publish Resume #34

Compile and Publish Resume

Compile and Publish Resume #34

Workflow file for this run

name: Compile and Publish Resume
on:
push:
branches:
- 'two-pages'
env:
resume-file: resume.pdf
artifact-id: resume
jobs:
build:
runs-on: ubuntu-latest
env:
node-version: 22
steps:
- uses: actions/checkout@v4
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: exiftool qpdf
version: 1.0
- uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}
cache: yarn
- name: Webpack build
run: |
yarn install
npx webpack --mode production --env HYPHENATE=no --env OUTPUT=final.pdf
- name: Verify manual hyphenation
run: |
mv dist/final.pdf .
cp final.pdf ${{ env.resume-file }}
npx webpack --mode production --env HYPHENATE=yes --env OUTPUT=shy.pdf
# Strip EXIF metadata, set (auto-generated, undeletable) ID to fixed value
exiftool -all= final.pdf dist/shy.pdf
qpdf --object-streams=disable final.pdf l
qpdf --object-streams=disable dist/shy.pdf r
sed -i "s|/ID \[[^]]*\]|/ID [<ID1><ID2>]|" l r
diff --brief l r
- name: Upload resume artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifact-id }}
path: ${{ env.resume-file }}
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download resume artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.artifact-id }}
- name: Create minimalistic index.html
run: |
cat << EOF > index.html
<meta http-equiv="refresh" content="0; URL=./${{ env.resume-file }}">
EOF
- name: Compute short SHA
run: echo SHORT_SHA=`echo ${GITHUB_SHA::7}` >> $GITHUB_ENV
- name: Deploy to GitHub Pages
# TODO: Consider using the official `deploy-pages` and `upload-pages-artifact` GitHub Actions
uses: peaceiris/actions-gh-pages@v3
with:
publish_dir: .
github_token: ${{ secrets.GITHUB_TOKEN }}
full_commit_message: Redeploy for ${{ env.SHORT_SHA }}