Skip to content

Commit ddaebf6

Browse files
committed
chore: Add GitHub action for Hugo
1 parent 5120ad6 commit ddaebf6

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

Diff for: .github/workflows/hugo.yml

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Deploy Hugo site to Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
pages: write
13+
id-token: write
14+
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: false
18+
19+
defaults:
20+
run:
21+
shell: bash
22+
23+
jobs:
24+
build:
25+
runs-on: ubuntu-latest
26+
env:
27+
HUGO_VERSION: 0.126.0
28+
steps:
29+
- name: Install Hugo CLI
30+
run: |
31+
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
32+
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
33+
- name: Checkout
34+
uses: actions/checkout@v4
35+
with:
36+
submodules: recursive
37+
fetch-depth: 0
38+
- name: Setup Pages
39+
id: pages
40+
uses: actions/configure-pages@v4
41+
- name: Install Node.js dependencies
42+
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
43+
- name: Build with Hugo
44+
env:
45+
HUGO_ENVIRONMENT: production
46+
HUGO_ENV: production
47+
TZ: America/Los_Angeles
48+
run: |
49+
hugo \
50+
--gc \
51+
--minify \
52+
--baseURL "${{ steps.pages.outputs.base_url }}/"
53+
- name: Upload artifact
54+
uses: actions/upload-pages-artifact@v3
55+
with:
56+
path: ./public
57+
58+
deploy:
59+
environment:
60+
name: github-pages
61+
url: ${{ steps.deployment.outputs.page_url }}
62+
runs-on: ubuntu-latest
63+
needs: build
64+
steps:
65+
- name: Deploy to GitHub Pages
66+
id: deployment
67+
uses: actions/deploy-pages@v4
68+

0 commit comments

Comments
 (0)