diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 00000000..047fb0ae --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,40 @@ +name: Deploy to GitHub Pages + +on: + push: + branches: ["main"] + workflow_dispatch: + +permissions: {} + +concurrency: + group: pages + cancel-in-progress: true + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: true + + - name: Setup mise + uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3.6.1 + with: + cache: true + + - name: Build docs + run: mise run build-docs + + - name: Push rendered site to gh-pages + uses: peaceiris/actions-gh-pages@84c30a85c19949d7eee79c4ff27748b70285e453 # v4.1.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs/public + publish_branch: gh-pages + keep_files: true + user_name: "github-actions[bot]" + user_email: "41898282+github-actions[bot]@users.noreply.github.com" diff --git a/.gitignore b/.gitignore index 9a3750a2..7f445b58 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ _site .gh-pages .idea +docs/.hugo_build.lock +docs/public/ .php_cs.cache .php-cs-fixer.cache .phpunit.cache/ diff --git a/dev-bin/release.sh b/dev-bin/release.sh index e033be17..afe85a25 100755 --- a/dev-bin/release.sh +++ b/dev-bin/release.sh @@ -168,19 +168,6 @@ php phpDocumentor.phar \ rm -rf "$cachedir" -page=index.md -cat <$page ---- -layout: default -title: MaxMind GeoIP2 PHP API -language: php -version: $tag ---- - -EOF - -cat ../README.md >>$page - git add doc/ echo "Release notes for $tag:" diff --git a/docs/hugo.toml b/docs/hugo.toml new file mode 100644 index 00000000..005ee095 --- /dev/null +++ b/docs/hugo.toml @@ -0,0 +1,14 @@ +baseURL = "https://maxmind.github.io/GeoIP2-php/" +title = "MaxMind GeoIP2 PHP API" +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 00000000..4f4fcc0a --- /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 00000000..849a0dfe --- /dev/null +++ b/docs/layouts/_default/default.html @@ -0,0 +1,207 @@ + + + + + + {{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ or .Title .File.BaseFileName }} | {{ .Site.Title }}{{ end }} + + + + +
+ {{ .Content }} +
+ + diff --git a/mise.lock b/mise.lock new file mode 100644 index 00000000..6f4350e8 --- /dev/null +++ b/mise.lock @@ -0,0 +1,33 @@ +# @generated - this file is auto-generated by `mise lock` https://mise.jdx.dev/dev-tools/mise-lock.html + +[[tools.hugo]] +version = "0.161.1" +backend = "aqua:gohugoio/hugo" + +[tools.hugo."platforms.linux-arm64"] +checksum = "sha256:382371ec3208236fb854ced51781f859b6c27a7d066b8fe90594eba14ba76d00" +url = "https://github.com/gohugoio/hugo/releases/download/v0.161.1/hugo_0.161.1_linux-arm64.tar.gz" + +[tools.hugo."platforms.linux-arm64-musl"] +checksum = "sha256:382371ec3208236fb854ced51781f859b6c27a7d066b8fe90594eba14ba76d00" +url = "https://github.com/gohugoio/hugo/releases/download/v0.161.1/hugo_0.161.1_linux-arm64.tar.gz" + +[tools.hugo."platforms.linux-x64"] +checksum = "sha256:fae28bf7909c1a42d1365b89d2e9e3d4194fbe5968ae0dd5504f562381018a1d" +url = "https://github.com/gohugoio/hugo/releases/download/v0.161.1/hugo_0.161.1_linux-amd64.tar.gz" + +[tools.hugo."platforms.linux-x64-musl"] +checksum = "sha256:fae28bf7909c1a42d1365b89d2e9e3d4194fbe5968ae0dd5504f562381018a1d" +url = "https://github.com/gohugoio/hugo/releases/download/v0.161.1/hugo_0.161.1_linux-amd64.tar.gz" + +[tools.hugo."platforms.macos-arm64"] +checksum = "sha256:b12e1cbebacf61f9cf67e0046c835142e70c829da7c16b05c1ec64a68885ee80" +url = "https://github.com/gohugoio/hugo/releases/download/v0.161.1/hugo_0.161.1_darwin-universal.pkg" + +[tools.hugo."platforms.macos-x64"] +checksum = "sha256:b12e1cbebacf61f9cf67e0046c835142e70c829da7c16b05c1ec64a68885ee80" +url = "https://github.com/gohugoio/hugo/releases/download/v0.161.1/hugo_0.161.1_darwin-universal.pkg" + +[tools.hugo."platforms.windows-x64"] +checksum = "sha256:7f8d030b37600c60bf2a782611257e6a768934fbe7724c1f3a1a501e6724cf0d" +url = "https://github.com/gohugoio/hugo/releases/download/v0.161.1/hugo_0.161.1_windows-amd64.zip" diff --git a/mise.toml b/mise.toml new file mode 100644 index 00000000..ecc66982 --- /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"