Skip to content

Commit 722a355

Browse files
authored
Create deploy-site.yml
Add GHA workflow for deploying the repo as a GitHub Pages site.
1 parent e9848e8 commit 722a355

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

.github/workflows/deploy-site.yml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Deploy Hugo site to Pages
2+
on:
3+
push:
4+
branches: ["main"]
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: read
9+
pages: write
10+
id-token: write
11+
12+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
13+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: false
17+
18+
defaults:
19+
run:
20+
shell: bash
21+
22+
jobs:
23+
build:
24+
runs-on: ubuntu-latest
25+
env:
26+
HUGO_VERSION: 0.128.0
27+
steps:
28+
- name: Install Hugo CLI
29+
run: |
30+
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
31+
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
32+
- name: Install Dart Sass
33+
run: sudo snap install dart-sass
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
with:
37+
submodules: recursive
38+
- name: Setup Pages
39+
id: pages
40+
uses: actions/configure-pages@v5
41+
- name: Install Node.js dependencies
42+
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
43+
- name: Build with Hugo
44+
env:
45+
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
46+
HUGO_ENVIRONMENT: production
47+
run: |
48+
hugo \
49+
--minify \
50+
--baseURL "${{ steps.pages.outputs.base_url }}/"
51+
- name: Upload artifact
52+
uses: actions/upload-pages-artifact@v3
53+
with:
54+
path: ./public
55+
56+
deploy:
57+
environment:
58+
name: github-pages
59+
url: ${{ steps.deployment.outputs.page_url }}
60+
runs-on: ubuntu-latest
61+
needs: build
62+
steps:
63+
- name: Deploy to GitHub Pages
64+
id: deployment
65+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)