File tree Expand file tree Collapse file tree 2 files changed +78
-0
lines changed
Expand file tree Collapse file tree 2 files changed +78
-0
lines changed 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 :
8+ - main
9+
10+ # Allows you to run this workflow manually from the Actions tab
11+ workflow_dispatch :
12+
13+ # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
14+ permissions :
15+ contents : read
16+ pages : write
17+ id-token : write
18+
19+ # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
20+ # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
21+ concurrency :
22+ group : " pages"
23+ cancel-in-progress : false
24+
25+ # Default to bash
26+ defaults :
27+ run :
28+ shell : bash
29+
30+ jobs :
31+ # Build job
32+ build :
33+ runs-on : ubuntu-latest
34+ # env:
35+ # HUGO_VERSION: 0.137.1
36+ steps :
37+ - name : Checkout
38+ uses : actions/checkout@v4
39+ - name : Install Hugo CLI
40+ run : make install-ci TMP_DIR=${{ runner.temp }}
41+ - name : Setup Pages
42+ id : pages
43+ uses : actions/configure-pages@v5
44+ - name : Install Node.js dependencies
45+ run : npm ci
46+ - name : Build with Hugo
47+ env :
48+ HUGO_CACHEDIR : ${{ runner.temp }}/hugo_cache
49+ HUGO_ENVIRONMENT : production
50+ TZ : Europe/Lisbon
51+ run : |
52+ hugo \
53+ --gc \
54+ --minify \
55+ --baseURL "${{ steps.pages.outputs.base_url }}/"
56+ - name : Upload artifact
57+ uses : actions/upload-pages-artifact@v3
58+ with :
59+ path : ./public
60+
61+ # Deployment job
62+ deploy :
63+ environment :
64+ name : github-pages
65+ url : ${{ steps.deployment.outputs.page_url }}
66+ runs-on : ubuntu-latest
67+ needs : build
68+ steps :
69+ - name : Deploy to GitHub Pages
70+ id : deployment
71+ uses : actions/deploy-pages@v4
Original file line number Diff line number Diff line change @@ -11,6 +11,13 @@ update:
1111 @echo New version: $(VERSION ) Old Version: $(HUGO_VERSION )
1212 @sed -i ' s/\(^HUGO_VERSION := \).*/\1 $(VERSION)/' Makefile
1313
14+ install-ci :
15+ @if [ -z $( TMP_DIR) ]; then \
16+ echo " Error: TMP_DIR is not set." ; \
17+ exit 1; \
18+ fi
19+ wget -O $(TMP_DIR ) /hugo.deb https://github.com/gohugoio/hugo/releases/download/v$(HUGO_VERSION ) /hugo_extended_$(HUGO_VERSION ) _linux-amd64.deb \
20+ && sudo dpkg -i $(TMP_DIR ) /hugo.deb
1421
1522install :
1623 CGO_ENABLED=1 go install -tags extended github.com/gohugoio/hugo@v$(HUGO_VERSION )
You can’t perform that action at this time.
0 commit comments