Skip to content

Commit 535644b

Browse files
authored
Merge pull request #221 from maxmind/greg/eng-4271
Deploy spec site with Hugo and GitHub Actions
2 parents 327e23a + 1c7a019 commit 535644b

File tree

6 files changed

+251
-2
lines changed

6 files changed

+251
-2
lines changed

.github/workflows/pages.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
run: mise run build-docs
31+
32+
- name: Configure Pages
33+
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
34+
35+
- name: Upload artifact
36+
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0
37+
with:
38+
path: docs/public
39+
40+
deploy:
41+
needs: build
42+
runs-on: ubuntu-latest
43+
permissions:
44+
pages: write
45+
id-token: write
46+
environment:
47+
name: github-pages
48+
url: ${{ steps.deployment.outputs.page_url }}
49+
steps:
50+
- name: Deploy to GitHub Pages
51+
id: deployment
52+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
/_site
1+
docs/.hugo_build.lock
2+
docs/public/
23
*.swp
34
/cmd/write-test-data/write-test-data

docs/hugo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
baseURL = "https://maxmind.github.io/MaxMind-DB/"
2+
title = "MaxMind DB"
3+
disableKinds = ["taxonomy"]
4+
5+
[markup.highlight]
6+
noClasses = true
7+
style = "github"
8+
9+
[[module.mounts]]
10+
source = "../MaxMind-DB-spec.md"
11+
target = "content/_index.md"
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 }}>

docs/layouts/_default/default.html

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

mise.toml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
[tools]
22
go = "latest"
3+
hugo = "latest"
34
node = "latest"
4-
golangci-lint = "latest"
5+
"github:golangci/golangci-lint" = "latest"
56
"github:houseabsolute/precious" = "latest"
67
"npm:prettier" = "latest"
8+
9+
[tasks.build-docs]
10+
description = "Build the spec site with Hugo"
11+
run = "hugo --source docs --minify"
12+
13+
[tasks.serve-docs]
14+
description = "Serve the spec site locally with Hugo dev server"
15+
run = "hugo server --source docs"

0 commit comments

Comments
 (0)