From a461d8bbbae7d5b0c802d7fb97b77a54f46628fe Mon Sep 17 00:00:00 2001 From: Frederic BIDON Date: Fri, 26 Jan 2024 20:32:47 +0100 Subject: [PATCH] added hugo build action Signed-off-by: Frederic BIDON --- .github/workflows/update-doc.yaml | 29 +++++++++++++----- hack/hugo/hugo-test/TODO.md | 4 +++ hack/hugo/hugo-test/hugo.yaml | 28 +++++++++-------- .../layouts/partials/docs/inject/footer.html | 4 +-- .../partials/docs/inject/menu-before.html | 3 -- hack/hugo/hugo-test/resources/.gitkeep | 0 hack/hugo/hugo-test/themes/go-swagger | 2 +- .../themes/go-swagger-assets/_custom.scss | 6 ++++ .../favicon.png | Bin .../logo.png | Bin 10 files changed, 50 insertions(+), 26 deletions(-) create mode 100644 hack/hugo/hugo-test/TODO.md create mode 100644 hack/hugo/hugo-test/resources/.gitkeep create mode 100644 hack/hugo/hugo-test/themes/go-swagger-assets/_custom.scss rename hack/hugo/hugo-test/themes/{go-swagger-assets => go-swagger-static}/favicon.png (100%) rename hack/hugo/hugo-test/themes/{go-swagger-assets => go-swagger-static}/logo.png (100%) diff --git a/.github/workflows/update-doc.yaml b/.github/workflows/update-doc.yaml index 3d0c72c77a..18328aafd4 100644 --- a/.github/workflows/update-doc.yaml +++ b/.github/workflows/update-doc.yaml @@ -2,8 +2,13 @@ name: "Update documentation" on: push: - branches: [ "master" , "exp/follow-up-hugo" ] - paths: [ "docs/*", "hack/hugo/*" ] + tags: + - v* + branches: [ "master" ] + paths: [ "docs/*", "hack/hugo/*", ".github/workflows/update-doc.yaml" ] + + pull_request: + paths: [ "docs/*", "hack/hugo/*", ".github/workflows/update-doc.yaml" ] permissions: contents: read @@ -17,6 +22,7 @@ concurrency: defaults: run: shell: bash + working-directory: ./hack/hugo/hugo-test jobs: hugo: @@ -25,11 +31,22 @@ jobs: - name: Checkout uses: actions/checkout@v4 + with: + submodules: true + # sparse-checkout: | + # hack/ + # docs/ + - + name: check + run: | + echo $(pwd) + ls + ls themes + ls themes/go-swagger + - name: Run Hugo uses: crazy-max/ghaction-hugo@v3 - run: - working-directory: hack/hugo/hugo-test with: version: latest extended: false @@ -38,12 +55,10 @@ jobs: name: Deploy to GitHub Pages if: github.event_name != 'pull_request' uses: crazy-max/ghaction-github-pages@v4 - run: - working-directory: hack/hugo/hugo-test with: target_branch: gh-pages build_dir: public - #repo: github.com/fredbi/go-swagger.github.io + repo: github.com/fredbi/go-swagger.github.io allow_empty_commit: false jekyll: false verbose: true diff --git a/hack/hugo/hugo-test/TODO.md b/hack/hugo/hugo-test/TODO.md new file mode 100644 index 0000000000..0e4be7443b --- /dev/null +++ b/hack/hugo/hugo-test/TODO.md @@ -0,0 +1,4 @@ +* [x] edit pages +* hugo-test -> final location +* auto-build & publish +* versioning docs? tree for tagged releases diff --git a/hack/hugo/hugo-test/hugo.yaml b/hack/hugo/hugo-test/hugo.yaml index 08323fe46f..2a21620b61 100644 --- a/hack/hugo/hugo-test/hugo.yaml +++ b/hack/hugo/hugo-test/hugo.yaml @@ -1,13 +1,17 @@ +title: go-swagger theme: hugo-book module: imports: - path: "go-swagger" - path: "go-swagger-assets" + - path: "go-swagger-static" mounts: - source: '../../../docs' target: 'content' - - source: 'themes/assets' + - source: 'themes/go-swagger-assets' + target: 'assets' + - source: 'themes/go-swagger-static' target: 'static' sitemap: @@ -16,6 +20,7 @@ sitemap: priority: -1 enableRobotsTXT: true +enableGitInfo: true menu: before: @@ -29,13 +34,12 @@ menu: after: - name: "" pre: "
" - post: '
The go-openapi toolkit
' + post: '
The go-openapi toolkit
' url: "https://github.com/go-openapi" weight: 1 - children: - - name: "go-openapi/analysis" - url: "https://github.com/go-openapi/analysis" - weight: 10 + - name: "go-openapi/analysis" + url: "https://github.com/go-openapi/analysis" + weight: 10 - name: "go-openapi/errors" url: "https://github.com/go-openapi/errors" weight: 20 @@ -77,11 +81,8 @@ params: # (Optional, default favicon.png) Set the path to a favicon file. # If the favicon is /static/favicon.png then the path would be favicon.png BookFavicon: "favicon.png" - BookLogo: "logo.png" - - # (Optional, default none) Set the path to a logo for the book. # If the logo is /static/logo.png then the path would be logo.png - # BookLogo: /logo.png + BookLogo: "logo.png" # (Optional, default none) Set leaf bundle to render as side menu # When not specified file structure and weights will be used @@ -94,19 +95,20 @@ params: # Set source repository location. # Used for 'Last Modified' and 'Edit this page' links. - BookRepo: 'https://github.com/go-swagger/go-swagger' + BookRepo: 'https://github.com/fredbi/go-swagger' # (Optional, default 'commit') Specifies commit portion of the link to the page's last modified # commit hash for 'doc' page type. # Requires 'BookRepo' param. # Value used to construct a URL consisting of BookRepo/BookCommitPath/ # Github uses 'commit', Bitbucket uses 'commits' - # BookCommitPath: commit + BookCommitPath: commit # Enable "Edit this page" links for 'doc' page type. # Disabled by default. Uncomment to enable. Requires 'BookRepo' param. # Edit path must point to root directory of repo. - #BookEditPath: edit/main/exampleSite + BookEditPath: edit/master + contentDir: docs # Configure the date format used on the pages # - In git information diff --git a/hack/hugo/hugo-test/layouts/partials/docs/inject/footer.html b/hack/hugo/hugo-test/layouts/partials/docs/inject/footer.html index 2cfecac2ef..e2d6e11116 100644 --- a/hack/hugo/hugo-test/layouts/partials/docs/inject/footer.html +++ b/hack/hugo/hugo-test/layouts/partials/docs/inject/footer.html @@ -1,7 +1,7 @@

- Copyright 2015-2024 go-swagger maintainers. + Copyright 2015-2024 the go-swagger maintainers. - This documentation is under an Apache 2.0 license. + This documentation is under an Apache 2.0 license.

diff --git a/hack/hugo/hugo-test/layouts/partials/docs/inject/menu-before.html b/hack/hugo/hugo-test/layouts/partials/docs/inject/menu-before.html index 39caa0d1df..cd360a1602 100644 --- a/hack/hugo/hugo-test/layouts/partials/docs/inject/menu-before.html +++ b/hack/hugo/hugo-test/layouts/partials/docs/inject/menu-before.html @@ -1,6 +1,3 @@ -

-go-swagger -

README

diff --git a/hack/hugo/hugo-test/resources/.gitkeep b/hack/hugo/hugo-test/resources/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/hack/hugo/hugo-test/themes/go-swagger b/hack/hugo/hugo-test/themes/go-swagger index c009016733..ac19935a4f 120000 --- a/hack/hugo/hugo-test/themes/go-swagger +++ b/hack/hugo/hugo-test/themes/go-swagger @@ -1 +1 @@ -/home/fred/src/github.com/go-swagger/go-swagger/docs \ No newline at end of file +../../../../docs \ No newline at end of file diff --git a/hack/hugo/hugo-test/themes/go-swagger-assets/_custom.scss b/hack/hugo/hugo-test/themes/go-swagger-assets/_custom.scss new file mode 100644 index 0000000000..0d93410b94 --- /dev/null +++ b/hack/hugo/hugo-test/themes/go-swagger-assets/_custom.scss @@ -0,0 +1,6 @@ +a[title]:hover::after { + content: attr(title); + position: absolute; + top: -100%; + left: 0; +} diff --git a/hack/hugo/hugo-test/themes/go-swagger-assets/favicon.png b/hack/hugo/hugo-test/themes/go-swagger-static/favicon.png similarity index 100% rename from hack/hugo/hugo-test/themes/go-swagger-assets/favicon.png rename to hack/hugo/hugo-test/themes/go-swagger-static/favicon.png diff --git a/hack/hugo/hugo-test/themes/go-swagger-assets/logo.png b/hack/hugo/hugo-test/themes/go-swagger-static/logo.png similarity index 100% rename from hack/hugo/hugo-test/themes/go-swagger-assets/logo.png rename to hack/hugo/hugo-test/themes/go-swagger-static/logo.png