Skip to content

Commit 8b1df14

Browse files
committed
Add automatic deployment to Github Pages + build on PRs
Also sets 'unsafe = true' because it is needed on newer versions of Hugo in order not to drop all the raw HTML we have in markdown files.
1 parent b5b3959 commit 8b1df14

File tree

3 files changed

+95
-0
lines changed

3 files changed

+95
-0
lines changed

.github/workflows/check.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Check Hugo build
2+
3+
on:
4+
# Runs on pushes targeting any branch and on pull requests
5+
push:
6+
pull_request:
7+
8+
# Allows you to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
11+
jobs:
12+
# Build job
13+
build:
14+
runs-on: ubuntu-latest
15+
env:
16+
HUGO_VERSION: 0.108.0
17+
steps:
18+
- name: Install Hugo CLI
19+
run: |
20+
DEBIAN_FRONTEND=noninteractive sudo apt-get update -y -qq
21+
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y hugo
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
- name: Build with Hugo
25+
run: |
26+
hugo

.github/workflows/deploy.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Deploy Hugo site to GitHub Pages
2+
3+
on:
4+
# Runs on pushes targeting the default branch
5+
push:
6+
branches: ["main", "master", "hugo", "ci"] # TODO: decide on a final branch name
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+
jobs:
24+
# Build job
25+
build:
26+
runs-on: ubuntu-latest
27+
env:
28+
HUGO_VERSION: 0.108.0
29+
steps:
30+
- name: Install Hugo CLI
31+
run: |
32+
DEBIAN_FRONTEND=noninteractive sudo apt-get update -y -qq
33+
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y hugo
34+
- name: Checkout
35+
uses: actions/checkout@v3
36+
- name: Setup Pages
37+
id: pages
38+
uses: actions/configure-pages@v3
39+
- name: Build with Hugo
40+
env:
41+
# For maximum backward compatibility with Hugo modules
42+
HUGO_ENVIRONMENT: production
43+
HUGO_ENV: production
44+
run: |
45+
hugo \
46+
--minify \
47+
--baseURL "${{ steps.pages.outputs.base_url }}/"
48+
- name: Upload artifact
49+
uses: actions/upload-pages-artifact@v1
50+
with:
51+
path: ./public
52+
53+
# Deployment job
54+
deploy:
55+
environment:
56+
name: github-pages
57+
url: ${{ steps.deployment.outputs.page_url }}
58+
runs-on: ubuntu-latest
59+
needs: build
60+
steps:
61+
- name: Deploy to GitHub Pages
62+
id: deployment
63+
uses: actions/deploy-pages@v2
64+

config.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,8 @@ publishDir = "../website"
6464
width = 50
6565
height = 50
6666
alt = "Logo"
67+
68+
[markup]
69+
[markup.goldmark]
70+
[markup.goldmark.renderer]
71+
unsafe = true

0 commit comments

Comments
 (0)