-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: basic netlify configuration for book
Signed-off-by: Carlos Salas <[email protected]>
- Loading branch information
1 parent
216046e
commit b9291b3
Showing
6 changed files
with
170 additions
and
13 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,43 @@ | ||
# Copyright 2024 The Kubernetes Authors. | ||
# | ||
# 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. | ||
|
||
# Directories. | ||
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) | ||
TOOLS_DIR := $(realpath ../../hack/tools) | ||
TOOLS_BIN_DIR := $(TOOLS_DIR)/bin | ||
BIN_DIR := bin | ||
MDBOOK_INSTALL := $(realpath ../../scripts/ci-install-mdbook.sh) | ||
TABULATE := $(TOOLS_BIN_DIR)/mdbook-tabulate | ||
EMBED := $(TOOLS_BIN_DIR)/mdbook-embed | ||
RELEASELINK := $(TOOLS_BIN_DIR)/mdbook-releaselink | ||
MDBOOK := $(TOOLS_BIN_DIR)/mdbook | ||
|
||
export PATH := $(TOOLS_BIN_DIR):$(PATH) | ||
|
||
BOOK_DEPS := $(MDBOOK) $(TABULATE) $(EMBED) $(RELEASELINK) | ||
|
||
$(TOOLS_BIN_DIR)/%: $(TOOLS_DIR_DEPS) | ||
make -C $(TOOLS_DIR) $(subst $(TOOLS_DIR)/,,$@) | ||
|
||
.PHONY: serve | ||
serve: $(BOOK_DEPS) ## Run a local web server with the compiled book | ||
$(MDBOOK) serve | ||
|
||
.PHONY: build | ||
build: $(BOOK_DEPS) ## Build the book | ||
$(MDBOOK) build | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf book |
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,69 @@ | ||
# Copyright 2024 The Kubernetes Authors. | ||
# | ||
# 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. | ||
|
||
ROOT_DIR_RELATIVE := ../.. | ||
|
||
UNAME := $(shell uname -s) | ||
|
||
OS := $(shell go env GOOS) | ||
RUST_TARGET := unknown-$(OS)-gnu | ||
|
||
ifeq ($(OS), darwin) | ||
RUST_TARGET := apple-darwin | ||
GH_ARCH_SUFFIX := macOS_amd64 | ||
GTAR := gtar | ||
endif | ||
|
||
# Directories. | ||
BIN_DIR := bin | ||
BIN_DIR_ABS := $(abspath $(BIN_DIR)) | ||
SHARE_DIR := share | ||
|
||
MDBOOK_EXTRACT_COMMAND := tar xfvz $(SHARE_DIR)/mdbook.tar.gz -C bin | ||
MDBOOK_ARCHIVE_EXT := .tar.gz | ||
|
||
MDBOOK_VERSION := v0.4.5 | ||
|
||
# Tooling binaries. | ||
$(BIN_DIR): | ||
mkdir -p $@ | ||
|
||
$(SHARE_DIR): | ||
mkdir -p $@ | ||
|
||
# Binaries. | ||
MDBOOK := $(BIN_DIR)/mdbook | ||
MDBOOK_SHARE := $(SHARE_DIR)/mdbook$(MDBOOK_ARCHIVE_EXT) | ||
$(MDBOOK): $(BIN_DIR) $(SHARE_DIR) | ||
curl -sL -o $(MDBOOK_SHARE) "https://github.com/rust-lang/mdBook/releases/download/$(MDBOOK_VERSION)/mdBook-$(MDBOOK_VERSION)-x86_64-$(RUST_TARGET)$(MDBOOK_ARCHIVE_EXT)" | ||
$(MDBOOK_EXTRACT_COMMAND) | ||
chmod +x $@ | ||
touch -m $@ | ||
|
||
MDBOOK_EMBED := $(BIN_DIR)/mdbook-embed | ||
$(MDBOOK_EMBED): $(BIN_DIR) go.mod go.sum | ||
go build -tags=tools -o $(BIN_DIR)/mdbook-embed sigs.k8s.io/cluster-api/hack/tools/mdbook/embed | ||
|
||
MDBOOK_RELEASELINK := $(BIN_DIR)/mdbook-releaselink | ||
$(MDBOOK_RELEASELINK): $(BIN_DIR) go.mod go.sum | ||
go build -tags=tools -o $(BIN_DIR)/mdbook-releaselink sigs.k8s.io/cluster-api/hack/tools/mdbook/releaselink | ||
|
||
MDBOOK_TABULATE := $(BIN_DIR)/mdbook-tabulate | ||
$(MDBOOK_TABULATE): $(BIN_DIR) go.mod go.sum | ||
go build -tags=tools -o $(BIN_DIR)/mdbook-tabulate sigs.k8s.io/cluster-api/hack/tools/mdbook/tabulate | ||
|
||
.PHONY: clean | ||
clean: ## Remove all tools | ||
rm -rf bin | ||
rm -rf share |
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
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,27 @@ | ||
# Netlify build instructions | ||
[build] | ||
command = "make -C docs/book build" | ||
publish = "docs/book/book" | ||
|
||
[build.environment] | ||
GO_VERSION = "1.21" | ||
|
||
# Standard Netlify redirects | ||
[[redirects]] | ||
from = "https://main--cluster-api-gcp.netlify.com/*" | ||
to = "https://main.cluster-api-gcp.sigs.k8s.io/:splat" | ||
status = 301 | ||
force = true | ||
|
||
# HTTP-to-HTTPS rules | ||
[[redirects]] | ||
from = "http://main.cluster-api-gcp.sigs.k8s.io/*" | ||
to = "https://main.cluster-api-gcp.sigs.k8s.io/:splat" | ||
status = 301 | ||
force = true | ||
|
||
[[redirects]] | ||
from = "http://main--cluster-api-gcp.netlify.com/*" | ||
to = "http://main.cluster-api-gcp.sigs.k8s.io/:splat" | ||
status = 301 | ||
force = true |