Skip to content

Commit b935db5

Browse files
authored
Merge pull request #486 from maxmind/greg/stf-448
Deploy docs site with Hugo and GitHub Actions
2 parents ab18948 + 2ce66b6 commit b935db5

11 files changed

Lines changed: 370 additions & 3 deletions

File tree

.github/workflows/pages.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
workflow_dispatch:
7+
8+
permissions: {}
9+
10+
concurrency:
11+
group: pages
12+
cancel-in-progress: true
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
steps:
20+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
21+
with:
22+
persist-credentials: false
23+
24+
- name: Setup mise
25+
uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3.6.1
26+
with:
27+
cache: true
28+
29+
- name: Build docs
30+
env:
31+
HUGO_BASEURL: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/
32+
run: mise run build-docs
33+
34+
- name: Configure Pages
35+
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
36+
37+
- name: Upload artifact
38+
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0
39+
with:
40+
path: docs/public
41+
42+
deploy:
43+
needs: build
44+
runs-on: ubuntu-latest
45+
permissions:
46+
pages: write
47+
id-token: write
48+
environment:
49+
name: github-pages
50+
url: ${{ steps.deployment.outputs.page_url }}
51+
steps:
52+
- name: Deploy to GitHub Pages
53+
id: deployment
54+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44
/cmd/geoipupdate/geoipupdate
55
/vendor
66
.idea
7+
docs/.hugo_build.lock
8+
docs/public/

_config.yml

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/assets/css/main.css

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
:root {
2+
--fg: #2d2d2d;
3+
--bg: #faf9f7;
4+
--accent: #1a6b50;
5+
--accent-soft: rgba(26, 107, 80, 0.06);
6+
--border: #d5d0c8;
7+
--code-bg: #f0eeea;
8+
--heading: #1a1a1a;
9+
--muted: #70695f;
10+
}
11+
12+
::selection {
13+
background: rgba(26, 107, 80, 0.15);
14+
}
15+
16+
*,
17+
*::before,
18+
*::after {
19+
box-sizing: border-box;
20+
}
21+
22+
body {
23+
font-family: Charter, "Bitstream Charter", "Sitka Text", Cambria, serif;
24+
font-size: 1.05rem;
25+
line-height: 1.78;
26+
color: var(--fg);
27+
background: var(--bg);
28+
max-width: 50rem;
29+
margin: 0 auto;
30+
padding: 3rem 1.5rem 5rem;
31+
}
32+
33+
h1,
34+
h2,
35+
h3,
36+
h4 {
37+
font-family: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
38+
line-height: 1.35;
39+
}
40+
41+
h1 {
42+
font-size: 1.75rem;
43+
font-weight: 800;
44+
color: var(--heading);
45+
margin: 0 0 1.5rem;
46+
padding-bottom: 0.75rem;
47+
border-bottom: 3px solid var(--accent);
48+
}
49+
50+
h2 {
51+
font-size: 1.3rem;
52+
font-weight: 700;
53+
color: var(--heading);
54+
margin: 3rem 0 0.75rem;
55+
padding-bottom: 0.4rem;
56+
border-bottom: 1px solid var(--border);
57+
}
58+
59+
h3 {
60+
font-size: 1.05rem;
61+
font-weight: 700;
62+
color: var(--accent);
63+
margin: 2.5rem 0 0.5rem;
64+
padding: 0.4rem 0.75rem;
65+
border-left: 3px solid var(--accent);
66+
background: linear-gradient(135deg, var(--accent-soft), transparent 80%);
67+
border-radius: 0 3px 3px 0;
68+
}
69+
70+
h4 {
71+
font-size: 0.92rem;
72+
font-weight: 700;
73+
color: var(--muted);
74+
margin: 2rem 0 0.5rem;
75+
padding-bottom: 0.2rem;
76+
border-bottom: 1px dashed var(--border);
77+
}
78+
79+
p {
80+
margin: 0.8rem 0;
81+
}
82+
83+
a {
84+
color: var(--accent);
85+
text-decoration-thickness: 1px;
86+
text-underline-offset: 2px;
87+
transition: text-decoration-thickness 0.15s;
88+
}
89+
90+
a:hover {
91+
text-decoration-thickness: 2px;
92+
}
93+
94+
strong {
95+
color: var(--heading);
96+
font-weight: 700;
97+
}
98+
99+
ol,
100+
ul {
101+
padding-left: 1.75rem;
102+
}
103+
104+
li + li {
105+
margin-top: 0.3rem;
106+
}
107+
108+
code {
109+
font-family: "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
110+
font-size: 0.88em;
111+
background: var(--code-bg);
112+
padding: 0.15em 0.4em;
113+
border-radius: 3px;
114+
border: 1px solid rgba(0, 0, 0, 0.06);
115+
}
116+
117+
pre {
118+
background: var(--code-bg);
119+
border: 1px solid var(--border);
120+
border-radius: 5px;
121+
padding: 1rem 1.25rem;
122+
overflow-x: auto;
123+
line-height: 1.55;
124+
}
125+
126+
pre code {
127+
background: none;
128+
padding: 0;
129+
border: none;
130+
font-size: 0.85em;
131+
}
132+
133+
img {
134+
max-width: 100%;
135+
height: auto;
136+
}
137+
138+
.heading-anchor {
139+
opacity: 0;
140+
margin-left: 0.3em;
141+
font-weight: 400;
142+
text-decoration: none;
143+
transition: opacity 0.15s;
144+
}
145+
146+
h1:hover .heading-anchor,
147+
h2:hover .heading-anchor,
148+
h3:hover .heading-anchor,
149+
h4:hover .heading-anchor,
150+
.heading-anchor:focus {
151+
opacity: 0.4;
152+
}
153+
154+
.heading-anchor:hover {
155+
opacity: 1;
156+
}
157+
158+
.page-nav {
159+
margin-bottom: 2.5rem;
160+
display: flex;
161+
gap: 0.5rem;
162+
flex-wrap: wrap;
163+
}
164+
165+
.page-nav a {
166+
font-family: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
167+
font-size: 0.85rem;
168+
font-weight: 600;
169+
text-decoration: none;
170+
color: var(--muted);
171+
padding: 0.3rem 0.75rem;
172+
border: 1px solid var(--border);
173+
border-radius: 999px;
174+
transition:
175+
color 0.15s,
176+
border-color 0.15s,
177+
background 0.15s;
178+
}
179+
180+
.page-nav a:hover {
181+
color: var(--accent);
182+
border-color: var(--accent);
183+
}
184+
185+
.page-nav a.active {
186+
color: var(--bg);
187+
background: var(--accent);
188+
border-color: var(--accent);
189+
}

docs/hugo.toml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
title = "GeoIP Update"
2+
disableKinds = ["taxonomy", "term", "RSS"]
3+
4+
[[cascade]]
5+
layout = "default"
6+
7+
[markup.highlight]
8+
noClasses = true
9+
style = "github"
10+
11+
[[module.mounts]]
12+
source = "../README.md"
13+
target = "content/_index.md"
14+
15+
[[module.mounts]]
16+
source = "../doc/docker.md"
17+
target = "content/doc/docker.md"
18+
19+
[[module.mounts]]
20+
source = "../doc/geoipupdate.md"
21+
target = "content/doc/geoipupdate.md"
22+
23+
[[module.mounts]]
24+
source = "../doc/GeoIP.conf.md"
25+
target = "content/doc/GeoIP.conf.md"

docs/layouts/404.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1" />
6+
<title>Page not found | {{ .Site.Title }}</title>
7+
{{- $css := resources.Get "css/main.css" | fingerprint -}}
8+
<link
9+
rel="stylesheet"
10+
href="{{ $css.RelPermalink }}"
11+
integrity="{{ $css.Data.Integrity }}"
12+
crossorigin="anonymous"
13+
/>
14+
</head>
15+
<body>
16+
<main>
17+
<h1>Page not found</h1>
18+
<p>
19+
The page you're looking for doesn't exist. Return to
20+
<a href="{{ .Site.Home.RelPermalink }}">{{ .Site.Title }}</a>.
21+
</p>
22+
</main>
23+
</body>
24+
</html>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<h{{ .Level }} id="{{ .Anchor }}">
2+
{{- .Text | safeHTML -}}
3+
<a class="heading-anchor" href="#{{ .Anchor }}" aria-label="Link to {{ .PlainText }}">#</a>
4+
</h{{ .Level }}>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{{- $u := urls.Parse .Destination -}}
2+
{{- $url := .Destination -}}
3+
{{- if and (not $u.Scheme) (strings.HasSuffix $u.Path ".md") -}}
4+
{{- with $.Page.GetPage $u.Path -}}
5+
{{- $url = .RelPermalink -}}
6+
{{- with $u.RawQuery }}{{ $url = printf "%s?%s" $url . }}{{ end -}}
7+
{{- with $u.Fragment }}{{ $url = printf "%s#%s" $url . }}{{ end -}}
8+
{{- end -}}
9+
{{- end -}}
10+
<a href="{{ $url | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}>{{ .Text | safeHTML }}</a>

docs/layouts/_default/default.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1" />
6+
{{- $title := or .Title .File.BaseFileName -}}
7+
<title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ $title }} | {{ .Site.Title }}{{ end }}</title>
8+
{{- $css := resources.Get "css/main.css" | fingerprint -}}
9+
<link
10+
rel="stylesheet"
11+
href="{{ $css.RelPermalink }}"
12+
integrity="{{ $css.Data.Integrity }}"
13+
crossorigin="anonymous"
14+
/>
15+
</head>
16+
<body>
17+
<main>
18+
{{ .Content }}
19+
</main>
20+
</body>
21+
</html>

mise.lock

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)