Skip to content

Commit b299b57

Browse files
Refactor docs versions to major.minor variants (#477)
## Summary Refactors the docs versioning structure from `v0`/`v1` to per-minor-version directories (`v0`, `v1.0`, `v1.1`, `v1.2`), making the site compatible with the push-based docs update pipeline from cozystack/cozystack#2214. ### What changed **Docs structure:** - Renamed `content/en/docs/v1/` → `v1.0/` - Bootstrapped `v1.1` and `v1.2` from `v1.0`, then pulled actual content from `release-1.1` and `release-1.2` branches - Added 301 redirect `/docs/v1/*` → `/docs/v1.0/:splat` in `netlify.toml` for backward compatibility **Version-aware Makefile:** - `RELEASE_TAG=v1.2.1` automatically derives `DOC_VERSION=v1.2`, `BRANCH=release-1.2` - `override BRANCH` fixes the mismatch where cozystack passes `BRANCH=release-1.2.1` but the actual branch is `release-1.2` - New targets: `init-version` (bootstrap new version dir), `download-openapi`, `download-openapi-all` **OpenAPI spec out of git:** - `v0` and `v1.0` keep `api.json` in-repo (no release asset available for those versions) - `v1.1` also keeps a copy in-repo (v1.1.x releases predate the openapi.json artifact) - `v1.2+` downloads `openapi.json` from GitHub releases at Netlify build time via `hack/download_openapi.sh` - `static/docs/*/cozystack-api/` added to `.gitignore` **Version switcher UI:** - Refactored from inline buttons to a Bootstrap dropdown — scales cleanly as versions grow - Fixed `version-banner.html` — replaced `int()` cast (breaks on `v1.0`) with index-based comparison **GitHub workflow:** - `update-managed-apps.yaml` now accepts `RELEASE_TAG` via dispatch payload or workflow input - Daily sync targets latest version (read from `hugo.yaml`) - Per-version PR branches: `update-managed-apps-v1.2` ### New scripts - `hack/init_version.sh` — copies content from previous version, updates all internal refs, removes `api.json` - `hack/download_openapi.sh` — downloads openapi.json from GitHub releases at build time (works without `gh` CLI) ### Note for cozystack/cozystack#2214 The `update-website-docs` job passes `BRANCH=release-X.Y.Z` (full version) but cozystack release branches are `release-X.Y` (major.minor). This PR handles the mismatch via `override BRANCH` in the Makefile, but ideally the cozystack workflow should also be fixed to pass `BRANCH=release-X.Y`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
2 parents 1d856cd + 332bf33 commit b299b57

610 files changed

Lines changed: 45393 additions & 495 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/update-managed-apps.yaml

Lines changed: 61 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ name: Sync documentation sources
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
release_tag:
7+
description: 'Release tag (e.g., v1.2.1) — leave empty for latest version'
8+
required: false
59
# 03:00 UTC, 05:00 Prague, usually all PRs in cozystack/cozystack get merged before this time.
610
schedule:
711
- cron: '0 3 * * *'
@@ -10,7 +14,7 @@ on:
1014
# curl -XPOST -H "Authorization: token <PAT>" \
1115
# -H "Accept: application/vnd.github.v3+json" \
1216
# https://api.github.com/repos/cozystack/website/dispatches \
13-
# -d '{"event_type":"update_managed_apps"}'
17+
# -d '{"event_type":"update_managed_apps","client_payload":{"release_tag":"v1.2.1"}}'
1418
repository_dispatch:
1519
types: [update_managed_apps]
1620

@@ -25,42 +29,87 @@ jobs:
2529
with:
2630
ref: 'main'
2731

32+
- name: Determine version parameters
33+
id: version
34+
env:
35+
RELEASE_TAG_INPUT: ${{ github.event.client_payload.release_tag || github.event.inputs.release_tag || '' }}
36+
run: |
37+
# Validate release tag format if provided
38+
if [[ -n "$RELEASE_TAG_INPUT" && ! "$RELEASE_TAG_INPUT" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
39+
echo "::error::Invalid release tag format: '$RELEASE_TAG_INPUT' (expected vX.Y.Z)"
40+
exit 1
41+
fi
42+
RELEASE_TAG="$RELEASE_TAG_INPUT"
43+
44+
if [[ -n "$RELEASE_TAG" ]]; then
45+
echo "release_tag=${RELEASE_TAG}" >> $GITHUB_OUTPUT
46+
# Derive doc version for branch naming
47+
VER="${RELEASE_TAG#v}"
48+
MAJOR="${VER%%.*}"
49+
MINOR="${VER#*.}"
50+
MINOR="${MINOR%%.*}"
51+
if [[ "$MAJOR" == "0" ]]; then
52+
DOC_VERSION="v0"
53+
else
54+
DOC_VERSION="v${MAJOR}.${MINOR}"
55+
fi
56+
echo "doc_version=${DOC_VERSION}" >> $GITHUB_OUTPUT
57+
echo "branch_suffix=${DOC_VERSION}" >> $GITHUB_OUTPUT
58+
else
59+
# Daily sync: target latest version from hugo.yaml
60+
LATEST=$(grep 'latest_version_id' hugo.yaml | head -1 | awk '{print $2}' | tr -d '"')
61+
echo "doc_version=${LATEST}" >> $GITHUB_OUTPUT
62+
echo "branch_suffix=${LATEST}" >> $GITHUB_OUTPUT
63+
fi
64+
2865
- name: Update docs via script
66+
env:
67+
RELEASE_TAG: ${{ steps.version.outputs.release_tag }}
68+
DOC_VERSION: ${{ steps.version.outputs.doc_version }}
2969
run: |
30-
make update-all
70+
if [[ -n "$RELEASE_TAG" ]]; then
71+
make update-all RELEASE_TAG="$RELEASE_TAG"
72+
else
73+
make update-all DOC_VERSION="$DOC_VERSION"
74+
fi
3175
git status -s
3276
3377
# Commit and push any changes
3478
- name: Commit & push changes
79+
env:
80+
DOC_VERSION: ${{ steps.version.outputs.doc_version }}
3581
run: |
82+
BRANCH="update-managed-apps-${DOC_VERSION}"
83+
3684
git config user.name "github-actions[bot]"
3785
git config user.email "github-actions[bot]@users.noreply.github.com"
3886
git add content
3987
if git diff --cached --quiet; then
4088
echo "No changes to commit"
4189
exit 0
4290
fi
43-
git branch -D update-managed-apps-reference || true
44-
git checkout -b update-managed-apps-reference
45-
git commit --signoff -m "[docs] Update managed apps reference $(date -u +'%Y-%m-%d %H:%M:%S')"
46-
git push --force --set-upstream origin update-managed-apps-reference
91+
git branch -D "$BRANCH" || true
92+
git checkout -b "$BRANCH"
93+
git commit --signoff -m "[docs] Update managed apps reference for ${DOC_VERSION} $(date -u +'%Y-%m-%d %H:%M:%S')"
94+
git push --force --set-upstream origin "$BRANCH"
4795
4896
- name: Open pull request if not exists
4997
env:
50-
# gh CLI will pick this up for authentication
5198
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99+
DOC_VERSION: ${{ steps.version.outputs.doc_version }}
52100
run: |
53-
# Determine PR state; value will be OPEN if there's a fresh PR or MERGED otherwise.
54-
# This workflow is reusing the same branch name, so it's not possible that the PR won't exist at all.
55-
pr_state=$(gh pr view update-managed-apps-reference --json state --jq .state 2>/dev/null || echo "")
101+
BRANCH="update-managed-apps-${DOC_VERSION}"
102+
103+
# Determine PR state
104+
pr_state=$(gh pr view "$BRANCH" --json state --jq .state 2>/dev/null || echo "")
56105
echo "Current PR state: ${pr_state:-NONE}"
57106
58107
if [[ "$pr_state" == "OPEN" ]]; then
59108
echo "An open pull request already exists – skipping creation."
60109
else
61110
gh pr create \
62-
--title "[docs] Update managed apps reference" \
111+
--title "[docs] Update managed apps reference for ${DOC_VERSION}" \
63112
--body "Automated update via workflow." \
64-
--head update-managed-apps-reference \
113+
--head "$BRANCH" \
65114
--base main
66115
fi

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,8 @@ hugo/
2222
# IDE files
2323
.idea
2424

25+
# Downloaded OpenAPI specs (fetched at build time)
26+
static/docs/*/cozystack-api/
27+
2528
# Claude Code local settings
2629
.claude/

Makefile

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,33 @@
1-
# Defaults (override on the command line: `make update-apps APPS="tenant redis" DEST_DIR="..."`)
1+
# Version derivation from RELEASE_TAG (e.g., v1.2.1 → DOC_VERSION=v1.2, BRANCH=v1.2.1)
2+
# When RELEASE_TAG is set, BRANCH is pinned to the exact tag for reproducible builds.
3+
RELEASE_TAG ?=
4+
ifdef RELEASE_TAG
5+
_ver := $(patsubst v%,%,$(RELEASE_TAG))
6+
_major := $(word 1,$(subst ., ,$(_ver)))
7+
_minor := $(word 2,$(subst ., ,$(_ver)))
8+
DOC_VERSION := $(if $(filter 0,$(_major)),v0,v$(_major).$(_minor))
9+
override BRANCH := $(RELEASE_TAG)
10+
else
11+
DOC_VERSION ?= v1.2
12+
BRANCH ?= main
13+
endif
14+
15+
# App lists (override on the command line: `make update-apps APPS="tenant redis"`)
216
APPS ?= tenant clickhouse foundationdb harbor redis mongodb openbao rabbitmq postgres nats kafka mariadb qdrant
317
K8S ?= kubernetes
418
VMS ?= vm-disk vm-instance
519
NETWORKING ?= vpc vpn http-cache tcp-balancer
620
SERVICES ?= bootbox etcd ingress monitoring seaweedfs
7-
APPS_DEST_DIR ?= content/en/docs/v1/applications
8-
K8S_DEST_DIR ?= content/en/docs/v1
9-
VMS_DEST_DIR ?= content/en/docs/v1/virtualization
10-
NETWORKING_DEST_DIR ?= content/en/docs/v1/networking
11-
SERVICES_DEST_DIR ?= content/en/docs/v1/operations/services
12-
BRANCH ?= main
13-
14-
.PHONY: update-apps update-vms update-networking update-k8s update-services update-oss-health update-all template-apps template-vms template-networking template-k8s template-services template-all
21+
APPS_DEST_DIR ?= content/en/docs/$(DOC_VERSION)/applications
22+
K8S_DEST_DIR ?= content/en/docs/$(DOC_VERSION)
23+
VMS_DEST_DIR ?= content/en/docs/$(DOC_VERSION)/virtualization
24+
NETWORKING_DEST_DIR ?= content/en/docs/$(DOC_VERSION)/networking
25+
SERVICES_DEST_DIR ?= content/en/docs/$(DOC_VERSION)/operations/services
26+
27+
.PHONY: update-apps update-vms update-networking update-k8s update-services update-oss-health update-all \
28+
template-apps template-vms template-networking template-k8s template-services template-all \
29+
init-version download-openapi download-openapi-all serve
30+
1531
update-apps:
1632
./hack/update_apps.sh --apps "$(APPS)" --dest "$(APPS_DEST_DIR)" --branch "$(BRANCH)"
1733

@@ -30,13 +46,29 @@ update-services:
3046
update-oss-health:
3147
./hack/update_oss_health.py
3248

33-
# requires cluster authentication
34-
# to be replaced with downloading a build/release artifact from github.com/cozystack/cozystack
35-
update-api:
36-
kubectl get --raw '/openapi/v3/apis/apps.cozystack.io/v1alpha1' > content/en/docs/cozystack-api/api.json
49+
# Download openapi.json for a specific version from GitHub release
50+
download-openapi:
51+
ifndef RELEASE_TAG
52+
$(error RELEASE_TAG is required for download-openapi (e.g., make download-openapi RELEASE_TAG=v1.2.1))
53+
endif
54+
@mkdir -p static/docs/$(DOC_VERSION)/cozystack-api
55+
@echo "Downloading openapi.json for $(RELEASE_TAG)..."
56+
@curl -fsSL -o static/docs/$(DOC_VERSION)/cozystack-api/api.json \
57+
"https://github.com/cozystack/cozystack/releases/download/$(RELEASE_TAG)/openapi.json" \
58+
&& echo "✓ Downloaded openapi.json for $(DOC_VERSION)" \
59+
|| echo "⚠️ openapi.json not available for $(RELEASE_TAG)"
60+
61+
# Download openapi.json for all versions at build time
62+
download-openapi-all:
63+
./hack/download_openapi.sh
64+
65+
# Initialize a new version directory from the previous version
66+
init-version:
67+
./hack/init_version.sh --version "$(DOC_VERSION)"
3768

38-
# doesn't include update-api, because it can't run in CI yet
69+
# doesn't include download-openapi (handled separately at build time)
3970
update-all:
71+
$(MAKE) init-version
4072
$(MAKE) update-apps
4173
$(MAKE) update-vms
4274
$(MAKE) update-networking

assets/scss/blocks/_nav.scss

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -248,36 +248,45 @@ nav.navbar {
248248
}
249249
}
250250

251-
// Sidebar version switcher
251+
// Sidebar version switcher (dropdown)
252252
.version-switcher {
253-
display: flex;
254-
gap: 0.5rem;
255253
padding: 0.75rem 1rem;
256254

257-
&__item {
258-
flex: 1;
259-
text-align: center;
260-
padding: 0.35rem 0.75rem;
255+
&__toggle {
256+
width: 100%;
257+
padding: 0.4rem 0.75rem;
261258
border-radius: 0.25rem;
262259
font-size: 0.85rem;
263260
font-weight: 600;
264261
color: $cozy-dark-blue;
265262
background: rgba($cozy-dark-blue, 0.05);
266263
border: 1px solid rgba($cozy-dark-blue, 0.2);
267-
text-decoration: none;
268-
transition: background 0.15s, color 0.15s;
264+
text-align: left;
265+
cursor: pointer;
266+
transition: background 0.15s;
269267

270268
&:hover {
271269
background: rgba($cozy-dark-blue, 0.12);
272270
}
273271

274-
&--active {
275-
background: $cozy-dark-blue;
276-
color: $cozy-white;
277-
border-color: $cozy-dark-blue;
272+
&::after {
273+
float: right;
274+
margin-top: 0.35rem;
275+
}
276+
}
277+
278+
&__menu {
279+
width: 100%;
280+
font-size: 0.85rem;
281+
min-width: unset;
282+
283+
.dropdown-item {
284+
font-weight: 600;
285+
color: $cozy-dark-blue;
278286

279-
&:hover {
280-
background: $cozy-darkest-blue;
287+
&.active {
288+
background: $cozy-dark-blue;
289+
color: $cozy-white;
281290
}
282291
}
283292
}

content/en/blog/2024-04-05-diy-create-your-own-cloud-with-kubernetes-part-1/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ two years ago was entirely built using this approach. But unfortunately, it does
170170
deploy your very first parent cluster that will hold the others. So now you have prepared a
171171
solution that will help you do this the same using PXE approach.
172172
173-
Essentially, all you need to do is [run temporary]({{% ref "/docs/v1/install/talos/pxe" %}})
173+
Essentially, all you need to do is [run temporary]({{% ref "/docs/v1.0/install/talos/pxe" %}})
174174
**DHCP** and **PXE** servers inside containers. Then your nodes will boot from your
175175
image, and you can use a simple Debian-flavored script to help you bootstrap your nodes.
176176

content/en/blog/2024-04-05-diy-create-your-own-cloud-with-kubernetes-part-2/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ project and development team.
2727
Virtual machines are the primary means of isolating tenants from each other in a cloud environment.
2828
In virtual machines, users can execute code and programs with administrative privilege, but this
2929
doesn't affect other tenants or the environment itself. In other words, virtual machines allow to
30-
achieve [hard multi-tenancy isolation]({{% ref "/docs/v1/guides/concepts#tenant-system" %}}), and run
30+
achieve [hard multi-tenancy isolation]({{% ref "/docs/v1.0/guides/concepts#tenant-system" %}}), and run
3131
in environments where tenants do not trust each other.
3232

3333
## Virtualization technologies in Kubernetes

content/en/docs/_index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ menu:
1010
weight: 40
1111
---
1212

13-
**New users:** Start with [v1 documentation](/docs/v1/) — the current stable release.
13+
**New users:** Start with [v1.2 documentation](/docs/v1.2/) — the current stable release.
1414

15-
**Existing v0.4x users:** Continue with [v0 documentation](/docs/v0/) until you're ready to [upgrade](/docs/v1/operations/upgrades/).
15+
**Existing v0.4x users:** Continue with [v0 documentation](/docs/v0/) until you're ready to [upgrade](/docs/v1.2/operations/upgrades/).
1616

1717
### Check Your Current Version
1818

@@ -22,10 +22,10 @@ If you have an existing installation, run:
2222
kubectl get deployment -n cozy-system
2323
```
2424

25-
- **v1:** You will see a `cozystack-operator` deployment.
25+
- **v1.x:** You will see a `cozystack-operator` deployment.
2626
- **v0:** You will see a `cozystack` deployment (the legacy installer).
27-
- **Namespace not found:** Cozystack is not installed — start with [v1](/docs/v1/).
27+
- **Namespace not found:** Cozystack is not installed — start with [v1.2](/docs/v1.2/).
2828

2929
**Additional Resources:**
3030
- [Release notes](https://github.com/cozystack/cozystack/releases)
31-
- [v0 to v1 upgrade guide](/docs/v1/operations/upgrades/)
31+
- [v0 to v1.x upgrade guide](/docs/v1.2/operations/upgrades/)

content/en/docs/v1.0/_index.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: "Cozystack v1.0 Documentation"
3+
linkTitle: "Cozystack v1.0"
4+
description: "Free PaaS platform and framework for building clouds"
5+
taxonomyCloud: []
6+
cascade:
7+
type: docs
8+
weight: 30
9+
aliases:
10+
- /docs/v1.0/reference
11+
- /docs/v1/
12+
---
13+
14+
Cozystack is a free PaaS platform and framework for building clouds
15+
16+
With Cozystack, you can transform your bunch of servers into an intelligent system with a simple REST API for spawning Kubernetes clusters, Database-as-a-Service, virtual machines, load balancers, HTTP caching services, and other services with ease.
17+
18+
You can use Cozystack to build your own cloud or to provide a cost-effective development environments.

content/en/docs/v1/applications/_include/clickhouse.md renamed to content/en/docs/v1.0/applications/_include/clickhouse.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ description: ""
55
weight: 50
66
aliases:
77
- /docs/reference/applications/clickhouse
8-
- /docs/v1/reference/applications/clickhouse
8+
- /docs/v1.0/reference/applications/clickhouse
99
---
1010

0 commit comments

Comments
 (0)