mirror of
https://github.com/googleapis/genai-toolbox.git
synced 2026-01-06 22:24:02 -05:00
docs: add site for hosting docs on github pages (#204)
Adds a static site generation using Hugo, and deployed to GitHub pages (googleapis.github.io/genai-toolbox).
This commit is contained in:
81
.github/workflows/docs_deploy.yaml
vendored
Normal file
81
.github/workflows/docs_deploy.yaml
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
# Copyright 2025 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
name: "docs"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'docs/**'
|
||||
- 'github/workflows/docs**'
|
||||
- '.hugo'
|
||||
|
||||
# Allow triggering manually.
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-22.04
|
||||
defaults:
|
||||
run:
|
||||
working-directory: .hugo
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
|
||||
|
||||
- name: Setup Hugo
|
||||
uses: peaceiris/actions-hugo@v3
|
||||
with:
|
||||
hugo-version: "latest"
|
||||
extended: true
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "22"
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-
|
||||
|
||||
- run: npm ci
|
||||
- run: hugo --minify
|
||||
env:
|
||||
# HUGO_BASEURL: https://${{ github.repository_owner }}.github.io/${{ github.repository }}
|
||||
# While private, GitHub uses an obfuscated url instead:
|
||||
HUGO_BASEURL: https://vigilant-guacamole-plnwrm9.pages.github.io/
|
||||
HUGO_RELATIVEURLS: false
|
||||
|
||||
- name: Deploy
|
||||
uses: peaceiris/actions-gh-pages@v4
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: .hugo/public
|
||||
# Do not delete previews on each production deploy.
|
||||
# CSS or JS changes will require manual clean-up.
|
||||
keep_files: true
|
||||
commit_message: "deploy: ${{ github.event.head_commit.message }}"
|
||||
59
.github/workflows/docs_preview_clean.yaml
vendored
Normal file
59
.github/workflows/docs_preview_clean.yaml
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
# Copyright 2025 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
name: "docs"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
# This Workflow depends on 'github.event.number',
|
||||
# not compatible with branch or manual triggers.
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- closed
|
||||
|
||||
jobs:
|
||||
clean:
|
||||
if: ${{ !github.event.pull_request.head.repo.fork }}
|
||||
runs-on: ubuntu-24.04
|
||||
concurrency:
|
||||
# Shared concurrency group wih preview staging.
|
||||
group: "preview-${{ github.event.number }}"
|
||||
cancel-in-progress: true
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: gh-pages
|
||||
|
||||
- name: Remove Preview
|
||||
run: |
|
||||
rm -Rf ./previews/PR-${{ github.event.number }}
|
||||
git config user.name 'github-actions[bot]'
|
||||
git config user.email 'github-actions[bot]@users.noreply.github.com'
|
||||
git add -u previews/PR-${{ github.event.number }}
|
||||
git commit --message "cleanup: previews/PR-${{ github.event.number }}"
|
||||
git push
|
||||
|
||||
- name: Comment
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
github.rest.issues.createComment({
|
||||
issue_number: context.payload.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: "🧨 Preview deployments removed."
|
||||
})
|
||||
95
.github/workflows/docs_preview_deploy.yaml
vendored
Normal file
95
.github/workflows/docs_preview_deploy.yaml
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
# Copyright 2025 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
name: "docs"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
# This Workflow depends on 'github.event.number',
|
||||
# not compatible with branch or manual triggers.
|
||||
on:
|
||||
pull_request:
|
||||
# Sync with github_actions_preview_fallback.yml on.pull_request.paths-ignore
|
||||
paths:
|
||||
- 'docs/**'
|
||||
- 'github/workflows/docs**'
|
||||
- '.hugo'
|
||||
|
||||
jobs:
|
||||
preview:
|
||||
runs-on: ubuntu-24.04
|
||||
defaults:
|
||||
run:
|
||||
working-directory: .hugo
|
||||
concurrency:
|
||||
# Shared concurrency group wih preview cleanup.
|
||||
group: "preview-${{ github.event.number }}"
|
||||
cancel-in-progress: true
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
|
||||
|
||||
- name: Setup Hugo
|
||||
uses: peaceiris/actions-hugo@v3
|
||||
with:
|
||||
hugo-version: "latest"
|
||||
extended: true
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "22"
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-
|
||||
|
||||
- run: npm ci
|
||||
- run: hugo --minify
|
||||
env:
|
||||
# HUGO_BASEURL: https://${{ github.repository_owner }}.github.io/${{ github.repository }}/previews/PR-${{ github.event.number }}/
|
||||
# While private, GitHub uses an obfuscated url instead:
|
||||
HUGO_BASEURL: https://vigilant-guacamole-plnwrm9.pages.github.io/previews/PR-${{ github.event.number }}/
|
||||
HUGO_ENVIRONMENT: preview
|
||||
HUGO_RELATIVEURLS: false
|
||||
|
||||
- name: Deploy
|
||||
# If run from a fork, GitHub write operations will fail.
|
||||
if: ${{ !github.event.pull_request.head.repo.fork }}
|
||||
uses: peaceiris/actions-gh-pages@v4
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: .hugo/public
|
||||
destination_dir: ./previews/PR-${{ github.event.number }}
|
||||
commit_message: "stage: PR-${{ github.event.number }}: ${{ github.event.head_commit.message }}"
|
||||
|
||||
- name: Comment
|
||||
# If run from a fork, GitHub write operations will fail.
|
||||
if: ${{ !github.event.pull_request.head.repo.fork }}
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
github.rest.issues.createComment({
|
||||
issue_number: context.payload.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: "🔎 Preview at https://vigilant-guacamole-plnwrm9.pages.github.io/previews/PR-${{ github.event.number }}/"
|
||||
})
|
||||
11
.gitignore
vendored
11
.gitignore
vendored
@@ -1,2 +1,13 @@
|
||||
# direnv
|
||||
.envrc
|
||||
|
||||
# vscode
|
||||
.vscode/
|
||||
|
||||
# npm
|
||||
node_modules
|
||||
|
||||
# hugo
|
||||
.hugo/public/
|
||||
.hugo/resources/_gen
|
||||
.hugo_build.lock
|
||||
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "docs2/themes/godocs"]
|
||||
path = docs2/themes/godocs
|
||||
url = https://github.com/themefisher/godocs.git
|
||||
5
.hugo/archetypes/default.md
Normal file
5
.hugo/archetypes/default.md
Normal file
@@ -0,0 +1,5 @@
|
||||
+++
|
||||
date = '{{ .Date }}'
|
||||
draft = true
|
||||
title = '{{ replace .File.ContentBaseName "-" " " | title }}'
|
||||
+++
|
||||
1
.hugo/assets/icons/logo.svg
Normal file
1
.hugo/assets/icons/logo.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 10 KiB |
2
.hugo/assets/scss/_variables_project.scss
Normal file
2
.hugo/assets/scss/_variables_project.scss
Normal file
@@ -0,0 +1,2 @@
|
||||
$primary: #D84040;
|
||||
$secondary: #8E1616;
|
||||
5
.hugo/go.mod
Normal file
5
.hugo/go.mod
Normal file
@@ -0,0 +1,5 @@
|
||||
module github.com/googleapis/genai-toolbox
|
||||
|
||||
go 1.23.2
|
||||
|
||||
require github.com/google/docsy v0.11.0 // indirect
|
||||
4
.hugo/go.sum
Normal file
4
.hugo/go.sum
Normal file
@@ -0,0 +1,4 @@
|
||||
github.com/FortAwesome/Font-Awesome v0.0.0-20240716171331-37eff7fa00de/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo=
|
||||
github.com/google/docsy v0.11.0 h1:QnV40cc28QwS++kP9qINtrIv4hlASruhC/K3FqkHAmM=
|
||||
github.com/google/docsy v0.11.0/go.mod h1:hGGW0OjNuG5ZbH5JRtALY3yvN8ybbEP/v2iaK4bwOUI=
|
||||
github.com/twbs/bootstrap v5.3.3+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0=
|
||||
43
.hugo/hugo.toml
Normal file
43
.hugo/hugo.toml
Normal file
@@ -0,0 +1,43 @@
|
||||
title = 'Gen AI Toolbox'
|
||||
relativeURLs = true
|
||||
|
||||
languageCode = 'en-us'
|
||||
contentDir = "../docs/en"
|
||||
defaultContentLanguage = "en"
|
||||
defaultContentLanguageInSubdir = false
|
||||
|
||||
enableGitInfo = true
|
||||
enableRobotsTXT = true
|
||||
|
||||
[languages]
|
||||
[languages.en]
|
||||
languageName ="English"
|
||||
weight = 1
|
||||
|
||||
[module]
|
||||
proxy = "direct"
|
||||
[module.hugoVersion]
|
||||
extended = true
|
||||
min = "0.73.0"
|
||||
[[module.imports]]
|
||||
path = "github.com/google/docsy"
|
||||
disable = false
|
||||
|
||||
[params]
|
||||
copyright = "Google LLC"
|
||||
github_repo = "https://github.com/googleapis/genai-toolbox"
|
||||
github_project_repo = "https://github.com/googleapis/genai-toolbox"
|
||||
github_subdir = "docs"
|
||||
offlineSearch = true
|
||||
[params.ui]
|
||||
ul_show = 100
|
||||
showLightDarkModeMenu = true
|
||||
breadcrumb_disable = true
|
||||
sidebar_menu_foldable = true
|
||||
sidebar_menu_compact = false
|
||||
|
||||
[[menu.main]]
|
||||
name = "GitHub"
|
||||
weight = 50
|
||||
url = "https://github.com/googleapis/genai-toolbox"
|
||||
pre = "<i class='fa-brands fa-github'></i>"
|
||||
1
.hugo/layouts/_default/_markup/render-heading.html
Normal file
1
.hugo/layouts/_default/_markup/render-heading.html
Normal file
@@ -0,0 +1 @@
|
||||
{{ template "_default/_markup/td-render-heading.html" . }}
|
||||
4
.hugo/layouts/robot.txt
Normal file
4
.hugo/layouts/robot.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
User-agent: *
|
||||
{{ if eq hugo.Environment "preview" }}
|
||||
Disallow: /*
|
||||
{{ end }}
|
||||
1097
.hugo/package-lock.json
generated
Normal file
1097
.hugo/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
7
.hugo/package.json
Normal file
7
.hugo/package.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"devDependencies": {
|
||||
"autoprefixer": "^10.4.20",
|
||||
"postcss": "^8.4.49",
|
||||
"postcss-cli": "^11.0.0"
|
||||
}
|
||||
}
|
||||
10
docs/en/_index.md
Normal file
10
docs/en/_index.md
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: "Documentation"
|
||||
type: docs
|
||||
notoc: false
|
||||
weight: 1
|
||||
description: >
|
||||
All of Toolbox's documentation.
|
||||
---
|
||||
|
||||
Placeholder for top-level directory.
|
||||
6
docs/en/concepts/_index.md
Normal file
6
docs/en/concepts/_index.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
title: "Concepts"
|
||||
type: docs
|
||||
weight: 2
|
||||
description: Some core concepts in Toolbox
|
||||
---
|
||||
6
docs/en/concepts/overview.md
Normal file
6
docs/en/concepts/overview.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
title: "Architecture"
|
||||
type: docs
|
||||
weight: 2
|
||||
description: An overview of Toolbox's architecture
|
||||
---
|
||||
6
docs/en/development/_index.md
Normal file
6
docs/en/development/_index.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
title: "Development"
|
||||
type: docs
|
||||
weight: 4
|
||||
description: A list of resources related to development of Toolbox
|
||||
---
|
||||
7
docs/en/development/contributing.md
Normal file
7
docs/en/development/contributing.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
title: "Contributing"
|
||||
type: docs
|
||||
weight: 2
|
||||
description: How to participate in Toolbox Development
|
||||
---
|
||||
|
||||
7
docs/en/getting-started/_index.md
Normal file
7
docs/en/getting-started/_index.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
title: "Getting Started"
|
||||
type: docs
|
||||
weight: 1
|
||||
description: >
|
||||
How to get started with Toolbox
|
||||
---
|
||||
10
docs/en/getting-started/introduction.md
Normal file
10
docs/en/getting-started/introduction.md
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: "Introduction"
|
||||
type: docs
|
||||
weight: 1
|
||||
description: An introduction to Toolbox
|
||||
---
|
||||
|
||||
# Introduction
|
||||
|
||||
This is a placeholder for the introduction.
|
||||
6
docs/en/resources/_index.md
Normal file
6
docs/en/resources/_index.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
title: "Resources"
|
||||
type: docs
|
||||
weight: 3
|
||||
description: List of reference documentation for resources in Toolbox
|
||||
---
|
||||
Reference in New Issue
Block a user