Skip to content

Commit 50ffc5f

Browse files
committed
Modernize GHA
1 parent a51427d commit 50ffc5f

1 file changed

Lines changed: 14 additions & 15 deletions

File tree

.github/workflows/hugo.yml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,60 @@
11
name: Deploy Hugo site to Pages
22

33
on:
4-
# Runs on pushes targeting the default branch
54
push:
65
branches: ["main"]
7-
8-
# Allows you to run this workflow manually from the Actions tab
96
workflow_dispatch:
107

11-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
128
permissions:
139
contents: read
1410
pages: write
1511
id-token: write
1612

17-
# Allow one concurrent deployment
1813
concurrency:
1914
group: "pages"
2015
cancel-in-progress: true
2116

22-
# Default to bash
2317
defaults:
2418
run:
2519
shell: bash
2620

2721
jobs:
28-
# Build job
2922
build:
3023
runs-on: ubuntu-latest
3124
env:
32-
HUGO_VERSION: 0.142.0 # the same as on my machine (Fedora dev box)
25+
HUGO_VERSION: 0.152.0
3326
steps:
34-
- name: Install Hugo CLI
35-
run: |
36-
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
37-
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
3827
- name: Checkout
3928
uses: actions/checkout@v4
4029
with:
4130
submodules: recursive
4231
fetch-depth: 0
32+
33+
- name: Setup Hugo
34+
uses: peaceiris/actions-hugo@v3
35+
with:
36+
hugo-version: ${{ env.HUGO_VERSION }}
37+
extended: true
38+
4339
- name: Setup Pages
4440
id: pages
4541
uses: actions/configure-pages@v4
42+
4643
- name: Build with Hugo
4744
env:
4845
HUGO_ENVIRONMENT: production
49-
HUGO_ENV: production
5046
TZ: Europe/Prague
5147
run: |
52-
hugo --gc --minify
48+
hugo \
49+
--gc \
50+
--minify \
51+
--baseURL "${{ steps.pages.outputs.base_url }}/"
52+
5353
- name: Upload artifact
5454
uses: actions/upload-pages-artifact@v3
5555
with:
5656
path: ./public
5757

58-
# Deployment job
5958
deploy:
6059
environment:
6160
name: github-pages

0 commit comments

Comments
 (0)