Skip to content

Commit 54c24d4

Browse files
authored
Add github actions workflow to deploy the site to github pages
1 parent 8753b81 commit 54c24d4

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

.github/workflows/hugo.yml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Build cli.fan with Huge and deploy the 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+
- name: Install Dart Sass
40+
run: sudo snap install dart-sass
41+
- name: Checkout
42+
uses: actions/checkout@v4
43+
with:
44+
submodules: recursive
45+
- name: Setup Pages
46+
id: pages
47+
uses: actions/configure-pages@v5
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+
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
53+
HUGO_ENVIRONMENT: production
54+
run: |
55+
hugo \
56+
--minify \
57+
--baseURL "${{ steps.pages.outputs.base_url }}/"
58+
- name: Upload artifact
59+
uses: actions/upload-pages-artifact@v3
60+
with:
61+
path: ./public
62+
63+
# Deployment job
64+
deploy:
65+
environment:
66+
name: github-pages
67+
url: ${{ steps.deployment.outputs.page_url }}
68+
runs-on: ubuntu-latest
69+
needs: build
70+
steps:
71+
- name: Deploy to GitHub Pages
72+
id: deployment
73+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)