Skip to content

Commit 4bbccaa

Browse files
authored
Update hugo.yml
1 parent 0dd4686 commit 4bbccaa

1 file changed

Lines changed: 25 additions & 61 deletions

File tree

.github/workflows/hugo.yml

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

43
on:
5-
# Runs on pushes targeting the default branch
64
push:
7-
branches: ["master"]
8-
9-
# Allows you to run this workflow manually from the Actions tab
10-
workflow_dispatch:
11-
12-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13-
permissions:
14-
contents: read
15-
pages: write
16-
id-token: write
17-
18-
# Allow one concurrent deployment
19-
concurrency:
20-
group: "pages"
21-
cancel-in-progress: true
22-
23-
# Default to bash
24-
defaults:
25-
run:
26-
shell: bash
5+
branches:
6+
- master # Set a branch to deploy
7+
pull_request:
278

289
jobs:
29-
# Build job
30-
build:
31-
runs-on: ubuntu-latest
32-
env:
33-
HUGO_VERSION: 0.102.3
10+
deploy:
11+
runs-on: ubuntu-22.04
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
3414
steps:
35-
- name: Install Hugo CLI
36-
run: |
37-
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.deb \
38-
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
39-
- name: Checkout
40-
uses: actions/checkout@v3
15+
- uses: actions/checkout@v3
4116
with:
42-
submodules: recursive
43-
- name: Setup Pages
44-
id: pages
45-
uses: actions/configure-pages@v2
46-
- name: Build with Hugo
47-
env:
48-
# For maximum backward compatibility with Hugo modules
49-
HUGO_ENVIRONMENT: production
50-
HUGO_ENV: production
51-
run: |
52-
hugo \
53-
--minify \
54-
--baseURL "${{ steps.pages.outputs.base_url }}/"
55-
- name: Upload artifact
56-
uses: actions/upload-pages-artifact@v1
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
5722
with:
58-
path: ./public
23+
hugo-version: 'latest'
24+
extended: true
5925

60-
# Deployment job
61-
deploy:
62-
environment:
63-
name: github-pages
64-
url: ${{ steps.deployment.outputs.page_url }}
65-
runs-on: ubuntu-latest
66-
needs: build
67-
steps:
68-
- name: Deploy to GitHub Pages
69-
id: deployment
70-
uses: actions/deploy-pages@v1
26+
- name: Build
27+
run: hugo --minify
28+
29+
- name: Deploy
30+
uses: peaceiris/actions-gh-pages@v3
31+
if: ${{ github.ref == 'refs/heads/main' }}
32+
with:
33+
github_token: ${{ secrets.GITHUB_TOKEN }}
34+
publish_dir: ./public

0 commit comments

Comments
 (0)