Skip to content

Commit 848e5c9

Browse files
vdusekclaude
andcommitted
fix: Remove all old versions for same major, not just the first match
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 0f8782e commit 848e5c9

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

.github/workflows/manual_version_docs.yaml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,22 +90,25 @@ jobs:
9090
echo "version=$FULL_VERSION" >> "$GITHUB_OUTPUT"
9191
echo "Version: $FULL_VERSION, Major.Minor: $MAJOR_MINOR_VERSION, Major: $MAJOR_VERSION"
9292
93-
# Find the existing version for this major in versions.json (if any).
93+
# Find the existing versions for this major in versions.json (if any).
9494
if [[ -f versions.json ]]; then
95-
OLD_VERSION="$(jq -r --arg major "$MAJOR_VERSION" '.[] | select(startswith($major + "."))' versions.json | head -1)"
95+
OLD_VERSIONS="$(jq -r --arg major "$MAJOR_VERSION" '.[] | select(startswith($major + "."))' versions.json)"
9696
else
97-
OLD_VERSION=""
97+
OLD_VERSIONS=""
9898
echo "[]" > versions.json
9999
fi
100100
101-
# Remove only the specific old version for this major (if found).
102-
if [[ -n "$OLD_VERSION" ]]; then
103-
echo "Removing old version $OLD_VERSION for major $MAJOR_VERSION"
104-
rm -rf "versioned_docs/version-${OLD_VERSION}"
105-
rm -f "versioned_sidebars/version-${OLD_VERSION}-sidebars.json"
106-
jq --arg old "$OLD_VERSION" '[.[] | select(. != $old)]' versions.json > tmp.json && mv tmp.json versions.json
101+
# Remove all old versions for this major (if found).
102+
if [[ -n "$OLD_VERSIONS" ]]; then
103+
while IFS= read -r OLD_VERSION; do
104+
[[ -z "$OLD_VERSION" ]] && continue
105+
echo "Removing old version $OLD_VERSION for major $MAJOR_VERSION"
106+
rm -rf "versioned_docs/version-${OLD_VERSION}"
107+
rm -f "versioned_sidebars/version-${OLD_VERSION}-sidebars.json"
108+
done <<< "$OLD_VERSIONS"
109+
jq --arg major "$MAJOR_VERSION" 'map(select(startswith($major + ".") | not))' versions.json > tmp.json && mv tmp.json versions.json
107110
else
108-
echo "No existing version found for major $MAJOR_VERSION, nothing to remove"
111+
echo "No existing versions found for major $MAJOR_VERSION, nothing to remove"
109112
fi
110113
111114
# Build API reference and create Docusaurus version snapshots.

0 commit comments

Comments
 (0)