1- name : Deploy Hugo site to Pages
1+ name : Build and Deploy Hugo site to gh-pages
22
33on :
44 # Runs on pushes targeting the default branch
88 # Allows you to run this workflow manually from the Actions tab
99 workflow_dispatch :
1010
11- # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
11+ # Sets permissions of the GITHUB_TOKEN to allow pushing to gh-pages
1212permissions :
13- contents : read
14- pages : write
15- id-token : write
16-
17- # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
18- # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
19- concurrency :
20- group : " pages"
21- cancel-in-progress : false
22-
23- # Default to bash
24- defaults :
25- run :
26- shell : bash
13+ contents : write
14+ pages : read
2715
2816jobs :
29- # Build job
30- build :
17+ build-and-deploy :
3118 runs-on : ubuntu-latest
3219 env :
3320 HUGO_VERSION : 0.128.0
@@ -37,47 +24,22 @@ jobs:
3724 wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
3825 && sudo dpkg -i ${{ runner.temp }}/hugo.deb
3926
40- - name : Install Dart Sass
41- run : sudo snap install dart-sass
42-
4327 - name : Checkout
4428 uses : actions/checkout@v4
4529 with :
4630 submodules : recursive
4731
48- - name : Setup Pages
49- id : pages
50- uses : actions/configure-pages@v4
51- with :
52- # Enable Pages if not already enabled
53- enablement : true
54-
55- - name : Install Node.js dependencies
56- run : " [[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
57-
5832 - name : Build with Hugo
5933 env :
60- # For maximum backward compatibility with Hugo modules
6134 HUGO_ENVIRONMENT : production
6235 HUGO_ENV : production
6336 run : |
64- hugo \
65- --minify \
66- --baseURL "${{ steps.pages.outputs.base_url }}/"
37+ hugo --minify
6738
68- - name : Upload artifact
69- uses : actions/upload-pages-artifact @v3
39+ - name : Deploy to gh-pages
40+ uses : peaceiris/actions-gh-pages @v3
7041 with :
71- path : ./public
72-
73- # Deployment job
74- deploy :
75- environment :
76- name : github-pages
77- url : ${{ steps.deployment.outputs.page_url }}
78- runs-on : ubuntu-latest
79- needs : build
80- steps :
81- - name : Deploy to GitHub Pages
82- id : deployment
83- uses : actions/deploy-pages@v4
42+ github_token : ${{ secrets.GITHUB_TOKEN }}
43+ publish_dir : ./public
44+ publish_branch : gh-pages
45+ force_orphan : true
0 commit comments