-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
site: add gohugo configuration and CI #1984
base: main
Are you sure you want to change the base?
Conversation
@marckhouzam can we please have this milestoned and merged? |
@umarcor when we merge this what should we see? Will there be a new gh site for users? Is there already one on your account? |
@marckhouzam the CI workflow will:
GitHub Pages allows serving the content of branch I suggest you push this branch to your fork, let CI run, and then check https://github.com/marckhouzam/cobra/settings/pages. When GitHub Pages is enabled in a repo, it will show in the sidebar, in section 'Environtments'. See my fork: https://github.com/umarcor/cobra. Also, in section 'About', the website can be set to the Pages (without manually typing it). GitHub Pages does also support setting a custom domain. Therefore, eventually we could make spf13.github.io/cobra be an alias of cobra.dev (or the other way round). I.e. users navigating to cobra.dev will see the content of the gh-pages of this repo. Yet, I don't think this PR alone is enough to replace cobra.dev. This is just to have CI and start treating documentation-as-code (e.g. checking for broken links/refs). I believe we should then discuss what theme we want, and reorganise the (sub)sections to better use the sidebar(s). The main reason to push this PR forward is the amount of issues and PRs related to cobra.dev being broken for several years already:
We could close all those issues/PRs with "The automatically generated and up-to-date content can be found in spf13.github.io/cobra. There is work-in-progress to make cobra.dev serve that content". |
ping @marckhouzam |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m finally going to give this PR some attention. I’ve just started but I’ll continue in the next little while
sorry for all the delay @umarcor
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- uses: actions/checkout@v3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@v4
@@ -0,0 +1,10 @@ | |||
module github.com/bep/docuapi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's name it github.com/spf13/cobra/site
If you could remove this file and do a hugo mod init github.com/spf13/cobra/site && hugo mod tidy
we'd get something more up-to-date
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'm on board with this.
Sorry @umarcor this took sooo long: I hadn't used Hugo before so I kept pushing this off as I needed to ramp up.
It has been so long that some parts of the PR would benefit with modernizing. I've put comments in those locations.
Some of my comments may be off as I don't have much experience with Hugo, but hopefully we can work out the details together.
@@ -0,0 +1,47 @@ | |||
name: 'site' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My VScode is interpreting a file name site.yml
to be an Ansible playbook and its trying to parse it as such.
There is surely a way for me to fix this, but I was wondering if it wouldn't be better for other contributors to rename this file so this "problem" doesn't happen?
pull_request: | ||
|
||
jobs: | ||
doc: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about giving it a more descriptive name? Maybe build website:
?
baseurl = "https://spf13.github.io/cobra/" | ||
title = "Cobra" | ||
|
||
disableKinds = ["taxonomyTerm"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm getting this warning: WARN DEPRECATED: Kind "taxonomyterm" used in disableKinds is deprecated, use "taxonomy" instead.
[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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about importing the theme we use (and removing the comment)? github.com/bep/docuapi/v2
Then I don't seem to need to git clone
the docuapi
repo.
@@ -0,0 +1,45 @@ | |||
theme = "docuapi" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
config.toml
is the old naming scheme (https://gohugo.io/getting-started/configuration/).
Let's rename to hugo.toml
.
Actually, would you ming using yaml instead? Since that is what we use for our other configurations?
Here is the converted content using an online converter (including the suggested changes in my comments):
hugo.yml:
# Seems not work with modules: theme: docuapi
languageCode: en-us
baseurl: 'https://spf13.github.io/cobra/'
title: Cobra
disableKinds: [taxonomy]
# Code higlighting settings
pygmentsCodefences: true
pygmentsCodeFencesGuessSyntax: false
pygmentsOptions: ''
pygmentsStyle: monokai
pygmentsUseClasses: false
defaultContentLanguage: en
module:
hugoVersion: {}
imports:
- path: github.com/bep/docuapi/v2
params:
search: true
markup:
goldmark:
parser:
autoHeadingIDType: github-ascii
renderer:
unsafe: true
languages:
en:
languageName: English
weight: 2
title: Cobra documentation
params:
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)
blackfriday:
angledQuotes: false
hrefTargetBlank: true
|
||
# Code higlighting settings | ||
pygmentsCodefences = true | ||
pygmentsCodeFencesGuesSsyntax = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pygmentsCodeFencesGuesSsyntax -> pygmentsCodeFencesGuessSyntax
@@ -0,0 +1,45 @@ | |||
theme = "docuapi" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been playing around with this and having the theme
line is not working for me unless I git clone
the docuapi
repo. But I find it simpler to add docuapi
as a module dependency, but then the theme
line give me an error. If I remove the theme line is seems to work.
|
||
- name: Get Hugo and Theme | ||
run: | | ||
curl -fsSL https://github.com/gohugoio/hugo/releases/download/v0.114.0/hugo_extended_0.114.0_Linux-64bit.tar.gz | sudo tar xzf - -C /usr/local/bin hugo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using a github action?
This seems to be the most popular: https://github.com/marketplace/actions/hugo-setup
This example should suit our needs I think: https://github.com/peaceiris/actions-hugo?tab=readme-ov-file#%EF%B8%8F-workflow-for-autoprefixer-and-postcss-cli
run: | | ||
cd site/public/ | ||
touch .nojekyll | ||
git init |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to discuss this approach with you, but I'll wait to see what you think about the GH Action, which may change this approach.
Following #1428, this PR is a subset of #1245.
This PR adds the minimal configuration and a CI workflow to build a documentation site using hugo and push it to branch
gh-pages
(to be hosted at USERNAME.github.io/cobra).