Skip to content

Commit 69a0905

Browse files
authored
add workflow for building and hosting pages
1 parent 83110cd commit 69a0905

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

.github/workflows/hugo.yml

Lines changed: 68 additions & 0 deletions
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: ["master"]
6+
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: false
17+
18+
# Default to bash
19+
defaults:
20+
run:
21+
shell: bash
22+
23+
jobs:
24+
# Build job
25+
build:
26+
runs-on: ubuntu-latest
27+
env:
28+
HUGO_VERSION: 0.128.0
29+
steps:
30+
- name: Install Hugo CLI
31+
run: |
32+
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
33+
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
34+
- name: Install Dart Sass
35+
run: sudo snap install dart-sass
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
with:
39+
submodules: recursive
40+
- name: Setup Pages
41+
id: pages
42+
uses: actions/configure-pages@v5
43+
- name: Install Node.js dependencies
44+
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
45+
- name: Build with Hugo
46+
env:
47+
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
48+
HUGO_ENVIRONMENT: production
49+
run: |
50+
hugo \
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+
# Deployment job
59+
deploy:
60+
environment:
61+
name: github-pages
62+
url: ${{ steps.deployment.outputs.page_url }}
63+
runs-on: ubuntu-latest
64+
needs: build
65+
steps:
66+
- name: Deploy to GitHub Pages
67+
id: deployment
68+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)