-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In this PR, a GitHub Actions workflow is added for building a web sit…
…e with [Hugo](https://gohugo.io/) and deploying it to GitHub Pages (branch `gh-pages`). - The content of the README is split to multiple markdown sources. - Markdown sources from the root and from subdir `doc` are moved to `site/content` . - Documentation sources regarding completions are placed in `site/content/completions`. - Documentation sources regarding documentation generation are placed in `site/content/docgen`. - Hugo configuration files are added to `site`. @bep's [docuapi](https://github.com/bep/docuapi) theme is used. - In a GitHub Actions workflow, Hugo is installed, the theme is installed, the site is built, and the site is uploaded as an artifact as well as pushed to branch `gh-pages`. - The logo from the README is used in the site (with a different font color). - Any contributor that forks the repo and pushes some change, will have the site automatically built and uploaded to `username.github.io/cobra`. See: - Proposed README: https://github.com/umarcor/cobra/blob/ci-site/README.md - Proposed site: https://umarcor.github.io/cobra - Example CI run: https://github.com/umarcor/cobra/actions/runs/288401296 (note the artifact) Ref #985 #1243 #1244 Merge spf13/cobra#1245
- Loading branch information
Showing
23 changed files
with
318 additions
and
127 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,45 @@ | ||
name: 'site' | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
doc: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- uses: actions/checkout@v2 | ||
|
||
- name: Get Hugo and Theme | ||
run: | | ||
curl -fsSL https://github.com/gohugoio/hugo/releases/download/v0.62.1/hugo_extended_0.62.1_Linux-64bit.tar.gz | sudo tar xzf - -C /usr/local/bin hugo | ||
sudo chmod +x /usr/local/bin/hugo | ||
mkdir -p site/themes | ||
cd site/themes | ||
git clone https://github.com/bep/docuapi | ||
cd docuapi | ||
npm install --only=dev | ||
mv node_modules ../.. | ||
- name: Build site | ||
run: | | ||
cd site | ||
hugo version | ||
hugo | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: site | ||
path: site/public | ||
|
||
- name: Publish site to gh-pages | ||
if: github.event_name != 'pull_request' | ||
run: | | ||
cd site/public/ | ||
touch .nojekyll | ||
git init | ||
cp ../../.git/config ./.git/config | ||
git add . | ||
git config --local user.email "push@gha" | ||
git config --local user.name "GHA" | ||
git commit -a -m "update ${{ github.sha }}" | ||
git push -u origin +HEAD:gh-pages |
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
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 @@ | ||
/public |
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,32 @@ | ||
// Overrides | ||
|
||
// BACKGROUND COLORS | ||
//////////////////// | ||
$nav-bg:#254E70 !default; | ||
$examples-bg: #002642 !default; | ||
|
||
|
||
// FONTS | ||
//////////////////// | ||
@import url("https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700&display=swap"); | ||
|
||
$font-default-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; | ||
|
||
// FLEX SIDEBAR | ||
//////////////////// | ||
|
||
.toc-wrapper { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
#toc { | ||
flex-grow: 1; | ||
} | ||
|
||
.toc-wrapper .toc-footer { | ||
margin-top: .5em; | ||
li { | ||
text-align: center; | ||
} | ||
} |
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,44 @@ | ||
theme = "docuapi" | ||
languageCode = "en-us" | ||
baseurl = "https://spf13.github.io/cobra/" | ||
title = "Cobra" | ||
|
||
disableKinds = ["taxonomyTerm"] | ||
|
||
# Code higlighting settings | ||
pygmentsCodefences = true | ||
pygmentsCodeFencesGuesSsyntax = false | ||
pygmentsOptions = "" | ||
pygmentsStyle = "monokai" | ||
pygmentsUseClasses = false | ||
|
||
defaultContentLanguage = "en" | ||
|
||
[module] | ||
[module.hugoVersion] | ||
[[module.imports]] | ||
# We need one module import for Hugo to detect us as a Hugo Module. | ||
path="github.com/bep/empty-hugo-module" | ||
|
||
[params] | ||
search = true | ||
|
||
[markup] | ||
[markup.goldmark] | ||
[markup.goldmark.parser] | ||
autoHeadingIDType = "github-ascii" | ||
[markup.goldmark.renderer] | ||
unsafe= true | ||
|
||
[languages] | ||
[languages.en] | ||
languageName = "English" | ||
weight = 2 | ||
title = "Cobra documentation" | ||
toc_footers = [ | ||
"[![github.com/spf13/cobra](https://img.shields.io/badge/-spf13/cobra-323131.svg?logo=github&style=flat-square&longCache=true)](https://github.com/spf13/cobra)", | ||
"Built with [Hugo](https://gohugo.io/) theme [DocuAPI](https://github.com/bep/docuapi) by [bep](https://github.com/bep)" | ||
] | ||
[languages.en.blackfriday] | ||
angledQuotes = false | ||
hrefTargetBlank = true |
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
Oops, something went wrong.