Skip to content

Commit 50a7545

Browse files
authored
Add CI validation
Add CI validation
1 parent 2b5dd6c commit 50a7545

File tree

5 files changed

+48
-2
lines changed

5 files changed

+48
-2
lines changed

.github/workflows/cd.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,26 @@ on: # yamllint disable-line rule:truthy
1010
- main
1111

1212
jobs:
13+
validate:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
submodules: recursive
19+
- name: Build site
20+
run: |
21+
docker run --rm \
22+
-v "$PWD":/src \
23+
-w /src \
24+
hugomods/hugo:reg-0.147.9 hugo
25+
- name: Validate pages
26+
run: |
27+
find content -name '*.md' \
28+
-exec printf 'Checking %s\n' {} \; \
29+
-exec ./validate-page.sh {} \;
1330
deploy:
1431
runs-on: ubuntu-latest
32+
needs: validate
1533
steps:
1634
# Run Hugo on the server to build the site
1735
- name: Build Site with Hugo

.github/workflows/ci.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: Validate Site
3+
4+
on:
5+
pull_request:
6+
7+
jobs:
8+
validate:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
submodules: recursive
14+
- name: Build site
15+
run: |
16+
docker run --rm \
17+
-v "$PWD":/src \
18+
-w /src \
19+
hugomods/hugo:reg-0.147.9 hugo
20+
- name: Validate pages
21+
run: |
22+
find content -name '*.md' \
23+
-exec printf 'Checking %s\n' {} \; \
24+
-exec ./validate-page.sh {} \;

.yamllint.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ ignore: |
66
77
rules:
88
line-length: disable
9+
truthy: disable

layouts/partials/head.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<meta name="description" content="{{ . }}">
4444
{{- end }}
4545
{{- with .Site.Params.author.name }}
46-
<meta name="author" content="{{ . }}"/>
46+
<meta name="author" content="{{ . }}">
4747
{{- end }}
4848
{{- partial "seo/main.html" . }}
4949
{{- with .Site.Params.favicon }}

validate-page.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ path=$1
1212
# Collapse multiple slashes to 1
1313
path=$(echo "$path" | sed -E 's#/+#/#g')
1414

15+
# Remove replace _index.md paths with the path that will lead to the index.
16+
if [[ $path == */_index.md ]]; then
17+
path=${path%/_index.md}
1518
# Remove .md from paths.
16-
if [[ $path == *.md ]]; then
19+
elif [[ $path == *.md ]]; then
1720
path=${path%.md}
1821
fi
1922

0 commit comments

Comments
 (0)