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+ 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+
58+ - name : Build with Hugo
59+ env :
60+ # For maximum backward compatibility with Hugo modules
61+ HUGO_ENVIRONMENT : production
62+ HUGO_ENV : production
63+ run : |
64+ hugo \
65+ --minify \
66+ --baseURL "${{ steps.pages.outputs.base_url }}/"
67+
68+ - name : Upload artifact
69+ uses : actions/upload-pages-artifact@v3
70+ 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
0 commit comments