File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Sample workflow for building and deploying a Hugo site to GitHub Pages
2+ name : Deploy Hugo site to Pages
3+
4+ on :
5+ # Runs on pushes targeting the default branch
6+ push :
7+ branches : ["main"]
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
27+
28+ jobs :
29+ # Build job
30+ build :
31+ runs-on : ubuntu-latest
32+ env :
33+ HUGO_VERSION : 0.108.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+ - name : Install Dart Sass Embedded
40+ run : sudo snap install dart-sass-embedded
41+ - name : Checkout
42+ uses : actions/checkout@v3
43+ with :
44+ submodules : recursive
45+ - name : Setup Pages
46+ id : pages
47+ uses : actions/configure-pages@v3
48+ - name : Install Node.js dependencies
49+ run : " [[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
50+ - name : Build with Hugo
51+ env :
52+ # For maximum backward compatibility with Hugo modules
53+ HUGO_ENVIRONMENT : production
54+ HUGO_ENV : production
55+ run : |
56+ hugo \
57+ --minify \
58+ --baseURL "${{ steps.pages.outputs.base_url }}/"
59+ - name : Upload artifact
60+ uses : actions/upload-pages-artifact@v1
61+ with :
62+ path : ./public
63+
64+ # Deployment job
65+ deploy :
66+ environment :
67+ name : github-pages
68+ url : ${{ steps.deployment.outputs.page_url }}
69+ runs-on : ubuntu-latest
70+ needs : build
71+ steps :
72+ - name : Deploy to GitHub Pages
73+ id : deployment
74+ uses : actions/deploy-pages@v1
You can’t perform that action at this time.
0 commit comments