Skip to content

Commit aa29d6e

Browse files
committed
Updated hugo.yaml
1 parent 9d4e4a3 commit aa29d6e

File tree

1 file changed

+66
-22
lines changed

1 file changed

+66
-22
lines changed

.github/workflows/hugo.yaml

Lines changed: 66 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,77 @@
1-
name: GitHub Pages
1+
# Sample workflow for building and deploying a Hugo site to GitHub Pages
2+
name: Deploy Hugo site to Pages
23

34
on:
5+
# Runs on pushes targeting the default branch
46
push:
57
branches:
68
- master
7-
pull_request:
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+
shell: bash
829

930
jobs:
10-
deploy:
11-
runs-on: ubuntu-20.04
12-
concurrency:
13-
group: ${{ github.workflow }}-${{ github.ref }}
31+
# Build job
32+
build:
33+
runs-on: ubuntu-latest
34+
env:
35+
HUGO_VERSION: 0.126.0
1436
steps:
15-
- uses: actions/checkout@v3
37+
- name: Install Hugo CLI
38+
run: |
39+
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
40+
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
41+
- name: Install Dart Sass
42+
run: sudo snap install dart-sass
43+
- name: Checkout
44+
uses: actions/checkout@v4
1645
with:
17-
submodules: true # Fetch Hugo themes (true OR recursive)
18-
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
19-
20-
- name: Setup Hugo
21-
uses: peaceiris/actions-hugo@v2
46+
submodules: recursive
47+
fetch-depth: 0
48+
- name: Setup Pages
49+
id: pages
50+
uses: actions/configure-pages@v4
51+
- name: Build with Hugo
52+
env:
53+
# For maximum backward compatibility with Hugo modules
54+
HUGO_ENVIRONMENT: production
55+
HUGO_ENV: production
56+
TZ: Europe/Warsaw
57+
run: |
58+
hugo \
59+
--gc \
60+
--minify \
61+
--baseURL "${{ steps.pages.outputs.base_url }}/"
62+
- name: Upload artifact
63+
uses: actions/upload-pages-artifact@v3
2264
with:
23-
hugo-version: 'latest'
24-
25-
- name: Build
26-
run: hugo --minify
65+
path: ./public
2766

28-
- name: Deploy
29-
uses: peaceiris/actions-gh-pages@v3
30-
if: ${{ github.ref == 'refs/heads/master' }}
31-
with:
32-
github_token: ${{ secrets.GITHUB_TOKEN }}
33-
publish_dir: ./public
67+
# Deployment job
68+
deploy:
69+
environment:
70+
name: github-pages
71+
url: ${{ steps.deployment.outputs.page_url }}
72+
runs-on: ubuntu-latest
73+
needs: build
74+
steps:
75+
- name: Deploy to GitHub Pages
76+
id: deployment
77+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)