From 5ed20fdcd362ea7e51ad16d4778858fadd2c96bd Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 27 Sep 2026 18:45:07 -0500 Subject: [PATCH] Docs(ci): Keep a stable release the default through trunk pushes why: A master push published latest as the default version, and a stable release publishes stable as the default, so after the first stable release every trunk push would take the default back and point readers and search engines at unreleased docs. what: - Make latest the default only while the repository has no vX.Y.Z release tag, read from its tags --- .github/workflows/docs.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index a64b953..7dc9a8d 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -110,7 +110,16 @@ jobs: {version: $alias, kind: "alias", isDefault: $alias_default, resolvesTo: $tag, environment: "docs", publish: true} ]}') elif [[ "$REF_NAME" == master ]]; then - matrix='{"include":[{"version":"latest","kind":"trunk","isDefault":true,"resolvesTo":"","environment":"docs","publish":true}]}' + # latest is the default only until the first stable release: + # from then on stable is, and a trunk push must not take the + # default back from it. + trunk_default=true + tags=$(git ls-remote --tags --refs "https://github.com/$REPOSITORY" | sed 's#.*refs/tags/##') + if grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$' <<< "$tags"; then + trunk_default=false + fi + matrix=$(jq -cn --argjson isDefault "$trunk_default" \ + '{include: [{version: "latest", kind: "trunk", isDefault: $isDefault, resolvesTo: "", environment: "docs", publish: true}]}') elif [[ "$REF_NAME" =~ ^v[0-9]+\.x$ ]]; then matrix=$(jq -cn --arg version "$REF_NAME" \ '{include: [{version: $version, kind: "branch", isDefault: false, resolvesTo: "", environment: "docs", publish: true}]}')