-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (43 loc) · 1.45 KB
/
gh-pages.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
name: Publish to Github Pages
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20.10"
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3.0.0
with:
hugo-version: '0.126.1'
extended: true
- name: Install node modules
run: |
hugo mod npm pack
npm install
- name: Replace build time variables
run: |
# set modified time as of today
today=$(date +%Y-%m-%d)
sed -i -E "s@^modifiedTime:.*@modifiedTime: \"${today}\"@" data/en/site.yaml
# replace last updated string with resume.pdf modified time
dtstr=$(date --date="@$(git log -1 --pretty="format:%ct" static/files/resume.pdf)" +"%b %Y")
[ -z "$dtstr" ] && { echo "Failed to get resume.pdf update time." ; exit 2 ; }
sed -i "s@_Jun 2025_@${dtstr}@g" data/en/sections/about.yaml
- name: Build
run: |
hugo --gc --minify --cleanDestinationDir
[ -f ./CNAME ] && cp ./CNAME ./public/CNAME || true
[ -f ./ALIAS ] && cp ./ALIAS ./public/ALIAS || true
- name: Deploy
uses: peaceiris/actions-gh-pages@v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: ./public