diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..89e278f --- /dev/null +++ b/.github/workflows/pages.yml @@ -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 diff --git a/.gitignore b/.gitignore index 3c6ce62..abf75b2 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,8 @@ *.so *.so.* *.sw? -.gh-pages +docs/.hugo_build.lock +docs/public/ .libs .tidyall.d MYMETA.json diff --git a/dev-bin/make-release.sh b/dev-bin/make-release.sh index 07201c0..2888e67 100755 --- a/dev-bin/make-release.sh +++ b/dev-bin/make-release.sh @@ -48,46 +48,5 @@ git commit -m "Bumped version to $TAG" ./configure make dist -if [ ! -d .gh-pages ]; then - echo "Checking out gh-pages in .gh-pages" - git clone -b gh-pages git@github.com:maxmind/mod_maxminddb.git .gh-pages - pushd .gh-pages -else - echo "Updating .gh-pages" - pushd .gh-pages - git pull -fi - -if [ -n "$(git status --porcelain)" ]; then - echo ".gh-pages is not clean" >&2 - exit 1 -fi - -INDEX=index.md -cat < $INDEX ---- -layout: default -title: mod_maxminddb - an Apache module that allows you to query MaxMind DB files -version: $TAG ---- -EOF - -cat ../README.md >> $INDEX - -if [ -n "$(git status --porcelain)" ]; then - git commit -m "Updated for $TAG" -a - - read -p "Push to origin? (yN) " SHOULD_PUSH - - if [ "$SHOULD_PUSH" != "y" ]; then - echo "Aborting" - exit 1 - fi - - git push -fi - -popd - git tag -a -m "Release for $TAG" $TAG git push --follow-tags diff --git a/docs/hugo.toml b/docs/hugo.toml new file mode 100644 index 0000000..0069cf2 --- /dev/null +++ b/docs/hugo.toml @@ -0,0 +1,14 @@ +baseURL = "https://maxmind.github.io/mod_maxminddb/" +title = "mod_maxminddb" +disableKinds = ["taxonomy"] + +[[cascade]] + layout = "default" + +[markup.highlight] + noClasses = true + style = "github" + +[[module.mounts]] + source = "../README.md" + target = "content/_index.md" diff --git a/docs/layouts/_default/_markup/render-heading.html b/docs/layouts/_default/_markup/render-heading.html new file mode 100644 index 0000000..4f4fcc0 --- /dev/null +++ b/docs/layouts/_default/_markup/render-heading.html @@ -0,0 +1,4 @@ + + {{- .Text | safeHTML -}} + # + diff --git a/docs/layouts/_default/default.html b/docs/layouts/_default/default.html new file mode 100644 index 0000000..324df8f --- /dev/null +++ b/docs/layouts/_default/default.html @@ -0,0 +1,172 @@ + + + + + + {{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ .Title }} | {{ .Site.Title }}{{ end }} + + + +
+ {{ .Content }} +
+ + diff --git a/mise.toml b/mise.toml new file mode 100644 index 0000000..ecc6698 --- /dev/null +++ b/mise.toml @@ -0,0 +1,24 @@ +[settings] +lockfile = true +disable_backends = [ + "asdf", + "vfox", +] + +[tools] +hugo = "latest" + +[hooks] +enter = "mise install --quiet" + +[[watch_files]] +patterns = ["mise.toml", "mise.lock"] +run = "mise install --quiet" + +[tasks.build-docs] +description = "Build the docs site with Hugo" +run = "hugo --source docs --minify" + +[tasks.serve-docs] +description = "Serve the docs site locally with Hugo dev server" +run = "hugo server --source docs"