-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (65 loc) · 2.05 KB
/
build-deploy.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
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 }}