Skip to content

Commit 5e66c7a

Browse files
authored
Merge pull request #331 from Danil-Grigorev/book-initial-structure
✨ Add workflow for a book publishing job
2 parents 322201a + 58d8160 commit 5e66c7a

File tree

6 files changed

+138
-0
lines changed

6 files changed

+138
-0
lines changed

.github/workflows/documentation.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Documentation
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
jobs:
15+
gh-pages:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v3
19+
- run: make -C docs/book build
20+
- name: Upload artifact
21+
uses: actions/upload-pages-artifact@v1
22+
with:
23+
path: ./docs/book/book
24+
25+
# Deployment job
26+
deploy:
27+
environment:
28+
name: github-pages
29+
url: ${{ steps.deployment.outputs.page_url }}
30+
runs-on: ubuntu-latest
31+
needs: gh-pages
32+
steps:
33+
- name: Deploy to GitHub Pages
34+
id: deployment
35+
uses: actions/deploy-pages@v2
36+

docs/book/Makefile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright 2023 The Kubernetes Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Directories.
16+
TOOLS_DIR := $(realpath ../../hack/tools)
17+
TOOLS_BIN_DIR := $(TOOLS_DIR)/bin
18+
BIN_DIR := bin
19+
MDBOOK_INSTALL := $(realpath ../../scripts/ci-install-mdbook.sh)
20+
21+
export PATH := $(abspath $(TOOLS_BIN_DIR)/bin):$(PATH)
22+
23+
# Only set MDBOOK if it's not set as an environment variable
24+
MDBOOK ?= $(TOOLS_BIN_DIR)/bin/mdbook
25+
$(MDBOOK):
26+
$(MDBOOK_INSTALL) 0.4.35 $(TOOLS_BIN_DIR)
27+
28+
.PHONY: serve
29+
serve: $(MDBOOK)
30+
$(MDBOOK) serve
31+
32+
.PHONY: build
33+
build: $(MDBOOK)
34+
$(MDBOOK) build

docs/book/book.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[book]
2+
language = "en"
3+
multilingual = false
4+
src = "src"
5+
title = "Cluster API Operator"
6+
description = "Cluster API Operator"
7+
8+
[preprocessor.toc]
9+
command = "mdbook-toc"
10+
marker = "[[_TOC_]]"
11+
12+
[preprocessor.fs-summary]
13+
# (default: true)
14+
clean-paths = false
15+
16+
# other preprocessors will naturally need to
17+
# run after the summary has been generated
18+
[preprocessor.links]
19+
after = ["fs-summary"]
20+
21+
[output.html]
22+
mathjax-support = true
23+
git-repository-url = "https://github.com/kubernetes-sigs/cluster-api-operator"
24+
git-repository-icon = "fa-github"
25+
site-url = "/cluster-api-operator/"
26+

docs/book/src/01_intro.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Cluster API Operator
2+
3+
## ✨ What is Cluster API Operator?
4+
5+
The **Cluster API Operator** is a Kubernetes Operator designed to empower cluster administrators to handle the lifecycle of Cluster API providers within a management cluster using a declarative approach. It aims to improve user experience in deploying and managing Cluster API, making it easier to handle day-to-day tasks and automate workflows with GitOps.
6+
7+
This operator leverages a declarative API and extends the capabilities of the `clusterctl` CLI, allowing greater flexibility and configuration options for cluster administrators.
8+

docs/book/src/SUMMARY.md

Whitespace-only changes.

scripts/ci-install-mdbook.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
# Copyright 2023 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -o errexit
18+
set -o nounset
19+
set -o pipefail
20+
21+
VERSION=${1}
22+
OUTPUT_PATH=${2}
23+
24+
# Ensure the output folder exists
25+
mkdir -p "${OUTPUT_PATH}"
26+
27+
# Install cargo
28+
curl https://sh.rustup.rs -sSf | sh -s -- -y
29+
. "$HOME/.cargo/env"
30+
31+
# Install mdbook and dependencies
32+
cargo install mdbook --version "$VERSION" --root "$OUTPUT_PATH"
33+
cargo install mdbook-fs-summary --root "$OUTPUT_PATH"
34+
cargo install mdbook-toc --root "$OUTPUT_PATH"

0 commit comments

Comments
 (0)