From 83560a895dc66df65d9828fbe2dc571cdf3b56f0 Mon Sep 17 00:00:00 2001
From: Zac Bergquist <zac.bergquist@goteleport.com>
Date: Thu, 2 Jan 2025 13:53:36 -0700
Subject: [PATCH] Ensure upcoming releases page is synchronized across branches

---
 scripts/prepare-files.mts | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/scripts/prepare-files.mts b/scripts/prepare-files.mts
index 8825627..66675d5 100644
--- a/scripts/prepare-files.mts
+++ b/scripts/prepare-files.mts
@@ -4,6 +4,7 @@ import { glob } from "glob";
 import { docusaurusifyNavigation } from "../server/config-docs";
 import {
   getCurrentVersion,
+  getLatestVersion,
   getVersionNames,
   getDocusaurusVersions,
 } from "../server/config-site";
@@ -17,6 +18,7 @@ const GET_VERSION_SIDEBAR_FILENAME = (version) =>
 
 const docusaurusVersions = getDocusaurusVersions();
 const currentVersion = getCurrentVersion();
+const defaultVersion = getLatestVersion();
 const versions = getVersionNames();
 
 const writeSidebar = (version: string) => {
@@ -66,3 +68,14 @@ versions.forEach((version) => {
 });
 
 writeVersions();
+
+// Make sure the upcoming releases page is the same on all 3 branches.
+const versionsToOverride = getVersionNames().filter(v => v !== defaultVersion);
+const defaultUpcomingReleases = resolve("content", defaultVersion, "docs/pages/upcoming-releases.mdx");
+versionsToOverride.forEach((version) => {
+  const destination = version === currentVersion
+    ? resolve("docs", "upcoming-releases.mdx")
+    : resolve(DOCS_PAGES_ROOT, `version-${version}`, "upcoming-releases.mdx");
+
+  copyFileSync(defaultUpcomingReleases, destination);
+})