update gh checkout #64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |