Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ on:
schedule:
- cron: '0 11 * * 5'

permissions:
contents: read
security-events: write

jobs:
analyze:
name: Analyze
Expand All @@ -24,29 +28,25 @@ jobs:
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['javascript']
language: ['javascript-typescript']
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v7

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
build-mode: none
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

Expand All @@ -59,4 +59,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v4
19 changes: 14 additions & 5 deletions .github/workflows/deploy-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,25 @@ on:

jobs:
deploy:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: '16'
node-version-file: .nvmrc
cache: 'npm'

- uses: actions/setup-go@v7
with:
go-version: '1.26.10'
cache: false
- uses: peaceiris/actions-hugo@v3
with:
hugo-version: '0.121.2'
extended: true

- name: Install dependencies
run: npm install
run: npm ci --ignore-scripts

- name: Check for linting errors
run: npm test
Expand Down
70 changes: 48 additions & 22 deletions .github/workflows/node.js-ci.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,60 @@
name: Hyas CI
name: Docsy CI

on:
push:
branches: main
branches: [main]
pull_request:
branches: main
branches: [main]

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ${{ matrix.os }}

timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node: [16.x, 18.x]

steps:
- name: Check out Hyas project
uses: actions/checkout@v2

- name: Set up Node.js ${{ matrix.node }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}

- name: Install dependencies
run: npm ci

- name: Run Hyas test script
run: npm test

- name: Build production website
run: npm run build
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
cache: npm
- uses: actions/setup-go@v7
with:
go-version: '1.26.10'
cache: false
- uses: peaceiris/actions-hugo@v3
with:
hugo-version: '0.121.2'
extended: true
- name: Install locked dependencies
run: npm ci --ignore-scripts
- name: Check the checked-in Markdown
run: npm test
- name: Build the production repository
run: npm run build
- name: Exercise the production Docsy stylesheet
run: npm run test:build
- name: Check the actual Netlify Make entries and indexing guards
if: runner.os == 'Linux'
env:
DEPLOY_PRIME_URL: https://example.invalid/
run: |
make non-production-build
grep -Fxq ' X-Robots-Tag: noindex' public/_headers
make deploy-preview
grep -Fxq ' X-Robots-Tag: noindex' public/_headers
make production-build
printf '/*\n X-Robots-Tag: noindex\n' > public/_headers
if HUGO_ENV=production make check-headers-file; then
echo 'Production incorrectly accepted noindex output'
exit 1
fi
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ nohup.out
.hugo_build.lock

# Netlify Functions build output
package-lock.json
/functions/
/node_modules/

Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22.23.4
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ build-preview: module-check
## deploy-preview: Deploy preview site via netlify
.PHONY: deploy-preview
deploy-preview:
GOMAXPROCS=1 $(TOOLS_DIR)/hugo --cleanDestinationDir --enableGitInfo --buildFuture --environment preview -b $(DEPLOY_PRIME_URL)
GOMAXPROCS=1 hugo --cleanDestinationDir --enableGitInfo --buildFuture --environment preview -b $(DEPLOY_PRIME_URL)
python scripts/netlify-headers.py preview
HUGO_ENV=preview $(MAKE) check-headers-file

## module-check: Check if all of the required submodules are correctly initialized.
.PHONY: module-check
Expand All @@ -153,7 +155,14 @@ production-build: module-check
## non-production-build: Build the non-production site, which adds noindex headers to prevent indexing
.PHONY: non-production-build
non-production-build: module-check
GOMAXPROCS=1 $(TOOLS_DIR)/hugo --cleanDestinationDir --enableGitInfo --environment nonprod
GOMAXPROCS=1 hugo --cleanDestinationDir --enableGitInfo --environment nonprod
python scripts/netlify-headers.py preview
HUGO_ENV=nonprod $(MAKE) check-headers-file

## check-headers-file: Validate the generated indexing headers for this context.
.PHONY: check-headers-file
check-headers-file:
@python scripts/netlify-headers.py check --environment "$${HUGO_ENV:-preview}"

## serve: Boot the development server.
.PHONY: serve
Expand Down
139 changes: 44 additions & 95 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,137 +1,86 @@
# OpenKF's docs

OpenKF's docs are built with [hugo](https://gohugo.io/), and can be browsed live at https://kind.sigs.k8s.io/
This repository uses [Hugo](https://gohugo.io/) and the Docsy v0.9.1 module.
The theme is pinned in `go.mod` and `go.sum`.

To browse them locally, install hugo and run `make serve` from this directory.
## Requirements

Read [tutorial](https://getdoks.org/docs/overview/introduction/), learning to use OpenKF document construction
- Node.js 22 LTS, using the version in `.nvmrc`.
- Hugo extended 0.121.2, matching the Netlify configuration.
- Go 1.21.5 or later, for Hugo Modules. CI uses Go 1.26.10.

## start local server

```bash
npm install
npm run start
```

## File Directory Description

| Directory | Description |
| ---------- | ------------------------------------------------------------ |
| archetypes | Directory for creating new content files with Hugo command. |
| assets | Directory for storing files that need to be processed by Hugo Pipes. |
| config | Directory for storing configuration directives in JSON, YAML, or TOML format. |
| content | Directory for storing all the content of your website. Each top-level folder is considered a content section. |
| data | Directory for storing configuration files that can be used by Hugo during website generation. |
| layouts | Directory for storing template files specifying how to render content views in the static website. |
| static | Directory for storing all static content such as images, CSS, JavaScript, etc. |
| resources | Directory for caching files to speed up the generation process. |
Install Hugo extended using the
[official installation instructions][hugo-install].
The npm install step does not download a separate Hugo executable.

[hugo-install]: https://gohugo.io/installation/

## Command

> **Note**💡:
> You can change the commands in the scripts section of `./package.json`.

### create

Create new content for your site:
## Install dependencies

```bash
npm run create [path] [flags]
npm ci
```

See also the Hugo docs: [hugo new](https://gohugo.io/commands/hugo_new/).
The committed lock file records the dependency tree. Keep it when cleaning
local build output or reinstalling dependencies.

### Docs based tree

Create a docs based tree — with a single command:
## Preview locally

```bash
npm run create -- --kind docs [section]
```

For example, create a docs based tree named guides:

```bash
npm run create -- --kind docs guides
```

## lint

Check scripts, styles, and markdown for errors:

```bash
npm run lint
```

### scripts

Check scripts for errors:

```bash
npm run lint:scripts [-- --fix]
```

### styles

Check styles for errors:

```bash
npm run lint:styles [-- --fix]
npm run start
```

### markdown
Use `npm run create -- path/to/page.md` to add a real documentation page.
This checkout currently has no `content` directory.

Check markdown for errors:
## Build

```bash
npm run lint:markdown [-- --fix]
npm run build
```

## clean
This runs Hugo in production mode, including Docsy's PostCSS stylesheet
pipeline, and writes the result to `public`.

Delete temporary directories:
To include draft and future pages in a preview build:

```bash
npm run clean
npm run build:preview
```

## start

Start local development server:
## Check Markdown

```bash
npm run start
npm test
```

## build

Build production website:
The Markdown rules cover root Markdown files and any pages under `content`.
To apply the linter's supported fixes:

```bash
npm run build
npm run lint:markdown-fix
```

### functions
## CI

Build Lambda functions:
CI installs the locked dependencies, checks Markdown, and builds the actual
repository with Node.js 22 and Hugo extended on Linux, Windows, and macOS.
It also creates a temporary synthetic Docsy page and style to check the real
production HTML, stylesheet link, and PostCSS/autoprefixer output. That context
is removed afterward; synthetic content is never added to the product site.

```bash
npm run build:functions
```
## Repository layout

### preview
- `hugo.toml`, `go.mod`, and `go.sum`: the pinned Docsy module.
- `i18n`: local translation overrides.
- `postcss.config.cjs`: the production autoprefixer plugin.
- `package.json` and `package-lock.json`: build and Markdown tooling.
- `scripts/check-docsy.py`: the temporary CI production build contract.

Build production website including draft and future content:
## Clean build output

```bash
npm run build:preview
```

---

```
hugo server
npm run clean
```

http://localhost:1313/
This removes `public` and `resources` without deleting the lock file.
2 changes: 1 addition & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ functions = "functions"
command = "git submodule update --init --recursive --depth 1 && make non-production-build"

[build.environment]
NODE_VERSION = "20.11.0"
NODE_VERSION = "22.23.4"
HUGO_VERSION = "0.121.2"

[context.production.environment]
Expand Down
Loading
Loading