Skip to content

Commit 8b57003

Browse files
committed
ci: workflow
1 parent 1a39bf6 commit 8b57003

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

workflows/hugo.yaml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Sample workflow for building and deploying a Hugo site to GitHub Pages
2+
name: Deploy Hugo site to Pages
3+
4+
on:
5+
push:
6+
branches:
7+
- 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 only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20+
concurrency:
21+
group: "pages"
22+
cancel-in-progress: false
23+
24+
# Default to bash
25+
defaults:
26+
run:
27+
shell: bash
28+
29+
jobs:
30+
# Build job
31+
build:
32+
runs-on: ubuntu-latest
33+
env:
34+
HUGO_VERSION: 0.123.6
35+
steps:
36+
- name: Install Hugo CLI
37+
run: |
38+
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
39+
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
40+
- name: Install Dart Sass
41+
run: sudo snap install dart-sass
42+
- name: Checkout
43+
uses: actions/checkout@v4
44+
with:
45+
submodules: recursive
46+
fetch-depth: 0
47+
- name: Setup Pages
48+
id: pages
49+
uses: actions/configure-pages@v4
50+
- name: Install Node.js dependencies
51+
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
52+
- name: Build with Hugo
53+
env:
54+
# For maximum backward compatibility with Hugo modules
55+
HUGO_ENVIRONMENT: production
56+
HUGO_ENV: production
57+
run: |
58+
hugo \
59+
--gc \
60+
--minify \
61+
--baseURL "${{ steps.pages.outputs.base_url }}/"
62+
- name: Upload artifact
63+
uses: actions/upload-pages-artifact@v2
64+
with:
65+
path: ./public
66+
67+
# Deployment job
68+
deploy:
69+
environment:
70+
name: github-pages
71+
url: ${{ steps.deployment.outputs.page_url }}
72+
runs-on: ubuntu-latest
73+
needs: build
74+
steps:
75+
- name: Deploy to GitHub Pages
76+
id: deployment
77+
uses: actions/deploy-pages@v3
78+

0 commit comments

Comments
 (0)