-
Notifications
You must be signed in to change notification settings - Fork 74
Deploy spec site with Hugo and GitHub Actions #221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| name: Deploy to GitHub Pages | ||
|
|
||
| on: | ||
| push: | ||
| branches: ["main"] | ||
| workflow_dispatch: | ||
|
|
||
| permissions: {} | ||
|
|
||
| concurrency: | ||
| group: pages | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup mise | ||
| uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3.6.1 | ||
| with: | ||
| cache: true | ||
|
|
||
| - name: Build docs | ||
| run: mise run build-docs | ||
|
|
||
| - name: Configure Pages | ||
| uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0 | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0 | ||
| with: | ||
| path: docs/public | ||
|
|
||
| deploy: | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| pages: write | ||
| id-token: write | ||
| environment: | ||
| name: github-pages | ||
| url: ${{ steps.deployment.outputs.page_url }} | ||
| steps: | ||
| - name: Deploy to GitHub Pages | ||
| id: deployment | ||
| uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| /_site | ||
| docs/.hugo_build.lock | ||
| docs/public/ | ||
| *.swp | ||
| /cmd/write-test-data/write-test-data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| baseURL = "https://maxmind.github.io/MaxMind-DB/" | ||
| title = "MaxMind DB" | ||
| disableKinds = ["taxonomy"] | ||
|
|
||
| [markup.highlight] | ||
| noClasses = true | ||
| style = "github" | ||
|
|
||
| [[module.mounts]] | ||
| source = "../MaxMind-DB-spec.md" | ||
| target = "content/_index.md" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| <h{{ .Level }} id="{{ .Anchor }}"> | ||
| {{- .Text | safeHTML -}} | ||
| <a class="heading-anchor" href="#{{ .Anchor }}" aria-label="Link to {{ .PlainText }}">#</a> | ||
| </h{{ .Level }}> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,172 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="utf-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
| <title>{{ .Title }}</title> | ||
| <style> | ||
| :root { | ||
| --fg: #2d2d2d; | ||
| --bg: #faf9f7; | ||
| --accent: #1a6b50; | ||
| --accent-soft: rgba(26, 107, 80, 0.06); | ||
| --border: #d5d0c8; | ||
| --code-bg: #f0eeea; | ||
| --heading: #1a1a1a; | ||
| --muted: #70695f; | ||
| } | ||
|
|
||
| ::selection { | ||
| background: rgba(26, 107, 80, 0.15); | ||
| } | ||
|
|
||
| *, | ||
| *::before, | ||
| *::after { | ||
| box-sizing: border-box; | ||
| } | ||
|
|
||
| body { | ||
| font-family: Charter, "Bitstream Charter", "Sitka Text", Cambria, serif; | ||
| font-size: 1.05rem; | ||
| line-height: 1.78; | ||
| color: var(--fg); | ||
| background: var(--bg); | ||
| max-width: 50rem; | ||
| margin: 0 auto; | ||
| padding: 3rem 1.5rem 5rem; | ||
| } | ||
|
|
||
| h1, | ||
| h2, | ||
| h3, | ||
| h4 { | ||
| font-family: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, | ||
| sans-serif; | ||
| line-height: 1.35; | ||
| } | ||
|
|
||
| h1 { | ||
| font-size: 1.75rem; | ||
| font-weight: 800; | ||
| color: var(--heading); | ||
| margin: 0 0 1.5rem; | ||
| padding-bottom: 0.75rem; | ||
| border-bottom: 3px solid var(--accent); | ||
| } | ||
|
|
||
| h2 { | ||
| font-size: 1.3rem; | ||
| font-weight: 700; | ||
| color: var(--heading); | ||
| margin: 3rem 0 0.75rem; | ||
| padding-bottom: 0.4rem; | ||
| border-bottom: 1px solid var(--border); | ||
| } | ||
|
|
||
| h3 { | ||
| font-size: 1.05rem; | ||
| font-weight: 700; | ||
| color: var(--accent); | ||
| margin: 2.5rem 0 0.5rem; | ||
| padding: 0.4rem 0.75rem; | ||
| border-left: 3px solid var(--accent); | ||
| background: linear-gradient( | ||
| 135deg, | ||
| var(--accent-soft), | ||
| transparent 80% | ||
| ); | ||
| border-radius: 0 3px 3px 0; | ||
| } | ||
|
|
||
| h4 { | ||
| font-size: 0.92rem; | ||
| font-weight: 700; | ||
| color: var(--muted); | ||
| margin: 2rem 0 0.5rem; | ||
| padding-bottom: 0.2rem; | ||
| border-bottom: 1px dashed var(--border); | ||
| } | ||
|
|
||
| p { | ||
| margin: 0.8rem 0; | ||
| } | ||
|
|
||
| a { | ||
| color: var(--accent); | ||
| text-decoration-thickness: 1px; | ||
| text-underline-offset: 2px; | ||
| transition: text-decoration-thickness 0.15s; | ||
| } | ||
|
|
||
| a:hover { | ||
| text-decoration-thickness: 2px; | ||
| } | ||
|
|
||
| strong { | ||
| color: var(--heading); | ||
| font-weight: 700; | ||
| } | ||
|
|
||
| ol, | ||
| ul { | ||
| padding-left: 1.75rem; | ||
| } | ||
|
|
||
| li + li { | ||
| margin-top: 0.3rem; | ||
| } | ||
|
|
||
| code { | ||
| font-family: "JetBrains Mono", "Cascadia Code", Menlo, Consolas, | ||
| monospace; | ||
| font-size: 0.88em; | ||
| background: var(--code-bg); | ||
| padding: 0.15em 0.4em; | ||
| border-radius: 3px; | ||
| border: 1px solid rgba(0, 0, 0, 0.06); | ||
| } | ||
|
|
||
| pre { | ||
| background: var(--code-bg); | ||
| border: 1px solid var(--border); | ||
| border-radius: 5px; | ||
| padding: 1rem 1.25rem; | ||
| overflow-x: auto; | ||
| line-height: 1.55; | ||
| } | ||
|
|
||
| pre code { | ||
| background: none; | ||
| padding: 0; | ||
| border: none; | ||
| font-size: 0.85em; | ||
| } | ||
|
|
||
| .heading-anchor { | ||
| opacity: 0; | ||
| margin-left: 0.3em; | ||
| font-weight: 400; | ||
| text-decoration: none; | ||
| transition: opacity 0.15s; | ||
| } | ||
|
|
||
| h1:hover .heading-anchor, | ||
| h2:hover .heading-anchor, | ||
| h3:hover .heading-anchor, | ||
| h4:hover .heading-anchor, | ||
| .heading-anchor:focus { | ||
| opacity: 0.4; | ||
| } | ||
|
|
||
| .heading-anchor:hover { | ||
| opacity: 1; | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <main> | ||
| {{ .Content }} | ||
| </main> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,15 @@ | ||
| [tools] | ||
| go = "latest" | ||
| hugo = "latest" | ||
| node = "latest" | ||
| golangci-lint = "latest" | ||
| "github:golangci/golangci-lint" = "latest" | ||
| "github:houseabsolute/precious" = "latest" | ||
| "npm:prettier" = "latest" | ||
|
|
||
| [tasks.build-docs] | ||
| description = "Build the spec site with Hugo" | ||
| run = "hugo --source docs --minify" | ||
|
|
||
| [tasks.serve-docs] | ||
| description = "Serve the spec site locally with Hugo dev server" | ||
| run = "hugo server --source docs" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
latestfor the Hugo version can lead to unexpected build failures if a new version of Hugo introduces breaking changes. For better build reproducibility, it's recommended to pin this to a specific version. You can find the latest version on the Hugo releases page.This also aligns with the repository's general rule about planning for updates when pinning versions, which implies that pinning is the preferred approach over using
latest.References
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a lockfile.