-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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).
- Loading branch information
Showing
23 changed files
with
1,476 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,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 }}" |
This file contains 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,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." | ||
}) |
This file contains 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,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 }}/" | ||
}) |
This file contains 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,2 +1,13 @@ | ||
# direnv | ||
.envrc | ||
|
||
# vscode | ||
.vscode/ | ||
|
||
# npm | ||
node_modules | ||
|
||
# hugo | ||
.hugo/public/ | ||
.hugo/resources/_gen | ||
.hugo_build.lock |
This file contains 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,3 @@ | ||
[submodule "docs2/themes/godocs"] | ||
path = docs2/themes/godocs | ||
url = https://github.com/themefisher/godocs.git |
This file contains 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,5 @@ | ||
+++ | ||
date = '{{ .Date }}' | ||
draft = true | ||
title = '{{ replace .File.ContentBaseName "-" " " | title }}' | ||
+++ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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,2 @@ | ||
$primary: #D84040; | ||
$secondary: #8E1616; |
This file contains 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,5 @@ | ||
module github.com/googleapis/genai-toolbox | ||
|
||
go 1.23.2 | ||
|
||
require github.com/google/docsy v0.11.0 // indirect |
This file contains 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 @@ | ||
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= |
Oops, something went wrong.