Skip to content

Commit 5b3b2da

Browse files
authored
Update GitHub Actions workflow for Hugo deployment
1 parent b283368 commit 5b3b2da

1 file changed

Lines changed: 14 additions & 23 deletions

File tree

.github/workflows/hugo.yaml

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,25 @@
1-
# Sample workflow for building and deploying a Hugo site to GitHub Pages
21
name: Deploy Hugo site to Pages
32

43
on:
5-
# Runs on pushes targeting the default branch
64
push:
75
branches:
86
- gh-pages
9-
10-
11-
# Allows you to run this workflow manually from the Actions tab
127
workflow_dispatch:
138

14-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
159
permissions:
1610
contents: read
1711
pages: write
1812
id-token: write
1913

20-
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
21-
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
2214
concurrency:
2315
group: "pages"
2416
cancel-in-progress: false
2517

26-
# Default to bash
2718
defaults:
2819
run:
2920
shell: bash
3021

3122
jobs:
32-
# Build job
3323
build:
3424
runs-on: ubuntu-latest
3525
env:
@@ -38,42 +28,43 @@ jobs:
3828
- name: Install Hugo CLI
3929
run: |
4030
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
41-
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
31+
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
32+
4233
- name: Install Dart Sass Embedded
4334
run: sudo snap install dart-sass-embedded
35+
4436
- name: Checkout
45-
uses: actions/checkout@v3
46-
with:
47-
submodules: recursive
48-
fetch-depth: 0
37+
uses: actions/checkout@v4
38+
4939
- name: Setup Pages
5040
id: pages
51-
uses: actions/configure-pages@v3
41+
uses: actions/configure-pages@v5
42+
5243
- name: Install Node.js dependencies
5344
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
45+
5446
- name: Build with Hugo
5547
env:
56-
# For maximum backward compatibility with Hugo modules
5748
HUGO_ENVIRONMENT: production
5849
HUGO_ENV: production
5950
run: |
6051
hugo \
6152
--gc \
6253
--minify \
63-
--baseURL "${{ steps.pages.outputs.base_url }}/"
54+
--baseURL "${{ steps.pages.outputs.base_url }}/"
55+
6456
- name: Upload artifact
65-
uses: actions/upload-pages-artifact@v1
57+
uses: actions/upload-pages-artifact@v3
6658
with:
6759
path: ./public
6860

69-
# Deployment job
7061
deploy:
62+
needs: build
63+
runs-on: ubuntu-latest
7164
environment:
7265
name: github-pages
7366
url: ${{ steps.deployment.outputs.page_url }}
74-
runs-on: ubuntu-latest
75-
needs: build
7667
steps:
7768
- name: Deploy to GitHub Pages
7869
id: deployment
79-
uses: actions/deploy-pages@v2
70+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)