Eric Liu
d96148c395
All checks were successful
Hugo Publish CI / build-and-deploy (push) Successful in 12s
40 lines
1.1 KiB
YAML
40 lines
1.1 KiB
YAML
name: Hugo Publish CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
submodules: true # Fetch Hugo themes (true OR recursive)
|
|
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
|
|
|
|
- name: Build site with Hugo
|
|
uses: peaceiris/actions-hugo@v3
|
|
with:
|
|
hugo-version: 'latest'
|
|
extended: true
|
|
|
|
- name: Build
|
|
run: hugo --minify
|
|
|
|
- name: Replace [commit] with short commit hash and hyperlink
|
|
run: |
|
|
SHORT_COMMIT=$(git rev-parse --short HEAD)
|
|
COMMIT_URL="https://git.ericxliu.me/eric/ericxliu-me/commit/$SHORT_COMMIT"
|
|
find ./public -type f -exec sed -i "s|\[commit\]|<a href=\"$COMMIT_URL\">\[$SHORT_COMMIT\]</a>|g" {} +
|
|
|
|
- name: Deploy
|
|
uses: peaceiris/actions-gh-pages@v4
|
|
with:
|
|
personal_token: ${{ secrets.TOKEN }}
|
|
publish_dir: ./public
|
|
publish_branch: gitea-pages |