1+ name : Deploy Hugo site to Pages
2+
3+ on :
4+ # Runs on pushes targeting the default branch
5+ push :
6+ branches : ["main"]
7+
8+ # Allows you to run this workflow manually from the Actions tab
9+ workflow_dispatch :
10+
11+ # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
12+ permissions :
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
27+
28+ jobs :
29+ # Build job
30+ build :
31+ runs-on : ubuntu-latest
32+ env :
33+ HUGO_VERSION : 0.128.0
34+ 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-amd64.deb \
38+ && sudo dpkg -i ${{ runner.temp }}/hugo.deb
39+
40+ - name : Install Dart Sass
41+ run : sudo snap install dart-sass
42+
43+ - name : Checkout
44+ uses : actions/checkout@v4
45+ with :
46+ submodules : recursive
47+
48+ - name : Setup Pages
49+ id : pages
50+ uses : actions/configure-pages@v4
51+
52+ - name : Install Node.js dependencies
53+ run : " [[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
54+
55+ - name : Build with Hugo
56+ env :
57+ # For maximum backward compatibility with Hugo modules
58+ HUGO_ENVIRONMENT : production
59+ HUGO_ENV : production
60+ run : |
61+ hugo \
62+ --minify \
63+ --baseURL "${{ steps.pages.outputs.base_url }}/"
64+
65+ - name : Upload artifact
66+ uses : actions/upload-pages-artifact@v3
67+ with :
68+ path : ./public
69+
70+ # Deployment job
71+ deploy :
72+ environment :
73+ name : github-pages
74+ url : ${{ steps.deployment.outputs.page_url }}
75+ runs-on : ubuntu-latest
76+ needs : build
77+ steps :
78+ - name : Deploy to GitHub Pages
79+ id : deployment
80+ uses : actions/deploy-pages@v4
0 commit comments