Skip to content

Commit 2ef9534

Browse files
committed
250722
1 parent 40179d1 commit 2ef9534

File tree

2 files changed

+123
-0
lines changed

2 files changed

+123
-0
lines changed

.github/workflows/hugo.yaml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Sample workflow for building and deploying a Hugo site to GitHub Pages
2+
name: Deploy Hugo site to Pages
3+
4+
on:
5+
# Runs on pushes targeting the default branch
6+
push:
7+
branches:
8+
- dev
9+
10+
# Allows you to run this workflow manually from the Actions tab
11+
workflow_dispatch:
12+
13+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
14+
permissions:
15+
contents: read
16+
pages: write
17+
id-token: write
18+
19+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
20+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
21+
concurrency:
22+
group: "pages"
23+
cancel-in-progress: false
24+
25+
# Default to bash
26+
defaults:
27+
run:
28+
# GitHub-hosted runners automatically enable `set -eo pipefail` for Bash shells.
29+
shell: bash
30+
31+
jobs:
32+
# Build job
33+
build:
34+
runs-on: ubuntu-latest
35+
env:
36+
DART_SASS_VERSION: 1.89.2
37+
HUGO_VERSION: 0.148.1
38+
HUGO_ENVIRONMENT: production
39+
TZ: America/Los_Angeles
40+
steps:
41+
- name: Install Hugo CLI
42+
run: |
43+
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb
44+
sudo dpkg -i ${{ runner.temp }}/hugo.deb
45+
- name: Install Dart Sass
46+
run: |
47+
wget -O ${{ runner.temp }}/dart-sass.tar.gz https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz
48+
tar -xf ${{ runner.temp }}/dart-sass.tar.gz --directory ${{ runner.temp }}
49+
mv ${{ runner.temp }}/dart-sass/ /usr/local/bin
50+
echo "/usr/local/bin/dart-sass" >> $GITHUB_PATH
51+
- name: Checkout
52+
uses: actions/checkout@v4
53+
with:
54+
submodules: recursive
55+
fetch-depth: 0
56+
- name: Setup Pages
57+
id: pages
58+
uses: actions/configure-pages@v5
59+
- name: Install Node.js dependencies
60+
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
61+
- name: Cache Restore
62+
id: cache-restore
63+
uses: actions/cache/restore@v4
64+
with:
65+
path: |
66+
${{ runner.temp }}/hugo_cache
67+
key: hugo-${{ github.run_id }}
68+
restore-keys: hugo-
69+
- name: Configure Git
70+
run: git config core.quotepath false
71+
- name: Build with Hugo
72+
run: |
73+
hugo \
74+
--gc \
75+
--minify \
76+
--baseURL "${{ steps.pages.outputs.base_url }}/" \
77+
--cacheDir "${{ runner.temp }}/hugo_cache"
78+
- name: Cache Save
79+
id: cache-save
80+
uses: actions/cache/save@v4
81+
with:
82+
path: |
83+
${{ runner.temp }}/hugo_cache
84+
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
85+
- name: Upload artifact
86+
uses: actions/upload-pages-artifact@v3
87+
with:
88+
path: ./public
89+
90+
# Deployment job
91+
deploy:
92+
environment:
93+
name: github-pages
94+
url: ${{ steps.deployment.outputs.page_url }}
95+
runs-on: ubuntu-latest
96+
needs: build
97+
steps:
98+
- name: Deploy to GitHub Pages
99+
id: deployment
100+
uses: actions/deploy-pages@v4

hugo.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,29 @@ title = 'VNS'
99
extended = true
1010
min = "0.148.1"
1111

12+
[caches]
13+
[caches.assets]
14+
dir = ':resourceDir/_gen'
15+
maxAge = -1
16+
[caches.getcsv]
17+
dir = ':cacheDir/:project'
18+
maxAge = -1
19+
[caches.getjson]
20+
dir = ':cacheDir/:project'
21+
maxAge = -1
22+
[caches.getresource]
23+
dir = ':cacheDir/:project'
24+
maxAge = -1
25+
[caches.images]
26+
dir = ':cacheDir/images'
27+
maxAge = -1
28+
[caches.misc]
29+
dir = ':cacheDir/:project'
30+
maxAge = -1
31+
[caches.modules]
32+
dir = ':cacheDir/modules'
33+
maxAge = -1
34+
1235
[languages]
1336
[languages.zh]
1437
contentDir = 'content/zh'

0 commit comments

Comments
 (0)