From 7a8509d1f17a43447c2cf46c4ffb2d780c2dd5a3 Mon Sep 17 00:00:00 2001 From: Erik Seliger Date: Thu, 27 Nov 2025 00:00:19 +0100 Subject: [PATCH 1/2] Make releases page fetch from releaseregistry This page wasn't maintained, fetching from release registry takes away that manual step and fixes that the page was stale. --- docs/releases.mdx | 88 +-------- src/components/MdxComponents.tsx | 8 +- src/components/ReleasesTable.tsx | 307 +++++++++++++++++++++++++++++++ 3 files changed, 316 insertions(+), 87 deletions(-) create mode 100644 src/components/ReleasesTable.tsx diff --git a/docs/releases.mdx b/docs/releases.mdx index 2aa364a4a..8e876cbd9 100644 --- a/docs/releases.mdx +++ b/docs/releases.mdx @@ -14,94 +14,10 @@ See the link to the corresponding release notes for more information on each rel Currently supported versions of Sourcegraph: -| **Release** | **General Availability Date** | **Supported** | **Release Notes** | **Install** | -| ------------ | ----------------------------- | ------------- | ------------------------------------------------------------------ | ---------------------------------------------------- | -| 6.8 Patch 1 | September 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v682313) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.8 Patch 0 | September 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v680) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.7 Patch 5 | September 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v672720) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.7 Patch 4 | September 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v672518) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.7 Patch 3 | August 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v671104) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.7 Patch 2 | August 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v67375) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.7 Patch 1 | August 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v67229) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.7 Patch 0 | August 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v670) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.6 Patch 2 | August 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v662517) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.6 Patch 1 | June 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v66868) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.6 Patch 0 | June 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v660) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.5 Patch 2 | June 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v652654) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.5 Patch 1 | June 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v651211) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.5 Patch 0 | June 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v650) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.4 Patch 3 | June 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v643889) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.4 Patch 2 | June 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v642622) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.4 Patch 1 | June 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v641203) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.4 Patch 0 | May 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v640) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.3 Patch 2 | May 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v634167) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.3 Patch 1 | May 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v632692) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.3 Patch 0 | April 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v630) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.2 Patch 3 | April 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v623841) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.2 Patch 2 | April 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v622553) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.2 Patch 1 | April 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v621106) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.2 Patch 0 | April 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v620) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.1 Patch 5 | March 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v615633) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.1 Patch 4 | March 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v614020) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.1 Patch 3 | March 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v612889) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.1 Patch 2 | February 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v611295) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.1 Patch 1 | February 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v61376) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.1 Patch 0 | February 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v610) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.0 Patch 2 | April 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v6012741) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.0 Patch 1 | February 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v602687) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 6.0 Patch 0 | January 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v600) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 5.11 Patch 5 | January 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v5116271) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 5.11 Patch 4 | January 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v5114013) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 5.11 Patch 3 | January 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v5114013) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 5.11 Patch 2 | January 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v5113601) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 5.11 Patch 1 | January 2025 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v5112732) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 5.11 Patch 0 | December 2024 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v5110) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 5.10 Patch 3 | December 2024 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v5103940) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 5.10 Patch 2 | December 2024 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v5102832) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 5.10 Patch 1 | December 2024 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v5101164) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 5.10 Patch 0 | November 2024 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v5100) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 5.9 Patch 3 | November 2024 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v591590) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 5.9 Patch 2 | November 2024 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v59347) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 5.9 Patch 1 | November 2024 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v5945) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 5.9 Patch 0 | October 2024 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v590) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 5.8 Patch 1 | October 2024 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v581579) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 5.8 Patch 0 | October 2024 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v580) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 5.7 Patch 1 | September 2024 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v572474) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 5.7 Patch 0 | September 2024 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v570) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 5.6 Patch 2 | August 2024 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v562535) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 5.6 Patch 1 | August 2024 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v56185) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 5.6 | August 2024 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v560) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 5.5 | July 2024 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v553956) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 5.4 | May 2024 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v547765) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 5.3 | February 2024 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v5312303) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 5.2 | October 2023 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v527) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 5.1 | June 2023 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v519) | [Install](https://sourcegraph.com/docs/admin/deploy) | -| 5.0 | March 2023 | ✅ | [Notes](https://sourcegraph.com/docs/technical-changelog#v506) | [Install](https://sourcegraph.com/docs/admin/deploy) | + ## Deprecated Releases These versions fall outside the release lifecycle and are not supported anymore: -| **Release** | **General Availability Date** | **Supported** | **Release Notes** | -| ----------- | ----------------------------- | ------------- | ----------------------------------------------------------------------------------------------- | -| 4.5 | February 2023 | ❌ | [Notes](https://sourcegraph.com/docs/technical-changelog#v451) | -| 4.4 | January 2023 | ❌ | [Notes](https://sourcegraph.com/docs/technical-changelog#v442) | -| 4.3 | December 2022 | ❌ | [Notes](https://sourcegraph.com/docs/technical-changelog#v431) | -| 4.2 | November 2022 | ❌ | [Notes](https://sourcegraph.com/docs/technical-changelog#v421) | -| 4.1 | October 2022 | ❌ | [Notes](https://sourcegraph.com/docs/technical-changelog#v413) | -| 4.0 | September 2022 | ❌ | [Notes](https://sourcegraph.com/docs/technical-changelog#v401) | -| 3.43 | August 2022 | ❌ | [Notes](https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3432) | -| 3.42 | July 2022 | ❌ | [Notes](https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3422) | -| 3.41 | June 2022 | ❌ | [Notes](https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3422) | -| 3.40 | May 2022 | ❌ | [Notes](https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3402) | -| 3.39 | April 2022 | ❌ | [Notes](https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3391) | -| 3.38 | March 2022 | ❌ | [Notes](https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3391) | -| 3.37 | February 2022 | ❌ | [Notes](https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3391) | -| 3.36 | January 2022 | ❌ | [Notes](https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3363) | -| 3.35 | December 2021 | ❌ | [Notes](https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3352) | -| 3.34 | November 2021 | ❌ | [Notes](https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3352) | -| 3.33 | October 2021 | ❌ | [Notes](https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3332) | -| 3.32 | September 2021 | ❌ | [Notes](https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3321) | -| 3.31 | August 2021 | ❌ | [Notes](https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3321) | -| 3.30 | July 2021 | ❌ | [Notes](https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3321) | -| 3.29 | June 2021 | ❌ | [Notes](https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3321) | + diff --git a/src/components/MdxComponents.tsx b/src/components/MdxComponents.tsx index 1a69e2b83..d65e3a2df 100644 --- a/src/components/MdxComponents.tsx +++ b/src/components/MdxComponents.tsx @@ -11,6 +11,10 @@ import {ProductCard, ProductCards} from './mdx/ProductCards'; import {QuickLink, QuickLinks} from './mdx/QuickLinks'; import {Tab, Tabs} from './mdx/Tabs'; import {PreCode, PreCodeBlock} from './PreCodeBlock'; +import { + SupportedReleasesTable, + DeprecatedReleasesTable +} from './ReleasesTable'; import ResourceEstimator from './resource-estimator/ResourceEstimator'; import {Badge} from './ui/badge'; @@ -75,7 +79,9 @@ const MdxComponents = (version?: string) => { ), Badge, - TierCallout + TierCallout, + SupportedReleasesTable, + DeprecatedReleasesTable }; }; diff --git a/src/components/ReleasesTable.tsx b/src/components/ReleasesTable.tsx new file mode 100644 index 000000000..daedf22f3 --- /dev/null +++ b/src/components/ReleasesTable.tsx @@ -0,0 +1,307 @@ +'use client'; + +import {useEffect, useState} from 'react'; + +type Release = { + id: number; + name: string; + public: boolean; + created_at: string; + promoted_at: string; + version: string; + git_sha: string; + is_development: boolean; + tags: string[] | null; + canonical_name: string; +}; + +function formatDate(dateString: string): string { + const date = new Date(dateString); + return date.toLocaleDateString('en-US', { + day: 'numeric', + month: 'long', + year: 'numeric' + }); +} + +function getChangelogAnchor(version: string): string { + return version.replace(/^v/, '').replace(/\./g, ''); +} + +type LegacyRelease = { + name: string; + date: string; + anchor: string; +}; + +const legacySupportedReleases: LegacyRelease[] = [ + {name: '5.10 Patch 1', date: 'December 2024', anchor: 'v5101164'}, + {name: '5.10 Patch 0', date: 'November 2024', anchor: 'v5100'}, + {name: '5.9 Patch 3', date: 'November 2024', anchor: 'v591590'}, + {name: '5.9 Patch 2', date: 'November 2024', anchor: 'v59347'}, + {name: '5.9 Patch 1', date: 'November 2024', anchor: 'v5945'}, + {name: '5.9 Patch 0', date: 'October 2024', anchor: 'v590'}, + {name: '5.8 Patch 1', date: 'October 2024', anchor: 'v581579'}, + {name: '5.8 Patch 0', date: 'October 2024', anchor: 'v580'}, + {name: '5.7 Patch 1', date: 'September 2024', anchor: 'v572474'}, + {name: '5.7 Patch 0', date: 'September 2024', anchor: 'v570'}, + {name: '5.6 Patch 2', date: 'August 2024', anchor: 'v562535'}, + {name: '5.6 Patch 1', date: 'August 2024', anchor: 'v56185'}, + {name: '5.6', date: 'August 2024', anchor: 'v560'}, + {name: '5.5', date: 'July 2024', anchor: 'v553956'}, + {name: '5.4', date: 'May 2024', anchor: 'v547765'}, + {name: '5.3', date: 'February 2024', anchor: 'v5312303'}, + {name: '5.2', date: 'October 2023', anchor: 'v527'}, + {name: '5.1', date: 'June 2023', anchor: 'v519'}, + {name: '5.0', date: 'March 2023', anchor: 'v506'} +]; + +export function SupportedReleasesTable() { + const [releases, setReleases] = useState([]); + const [loading, setLoading] = useState(true); + const [error, setError] = useState(null); + + useEffect(() => { + fetch('https://releaseregistry.sourcegraph.com/v1/releases/sourcegraph') + .then(res => { + if (!res.ok) throw new Error('Failed to fetch releases'); + return res.json(); + }) + .then((data: Release[]) => { + const supportedReleases = data.filter( + r => r.public && !r.is_development + ); + setReleases(supportedReleases); + setLoading(false); + }) + .catch(err => { + setError(err.message); + setLoading(false); + }); + }, []); + + if (loading) { + return ( +
+
Loading releases...
+
+ ); + } + + if (error) { + return ( +
+

+ Failed to load releases: {error} +

+
+ ); + } + + return ( +
+ + + + + + + + + + + + {releases.map(release => ( + + + + + + + + ))} + {legacySupportedReleases.map(release => ( + + + + + + + + ))} + +
+ Release + + General Availability Date + + Supported + + Release Notes + + Install +
+ {release.canonical_name} + + {formatDate(release.promoted_at)} + + + Notes + + + + Install + +
{release.name}{release.date} + + Notes + + + + Install + +
+
+ ); +} + +export function DeprecatedReleasesTable() { + const deprecatedReleases = [ + {version: '4.5', date: 'February 2023', anchor: 'v451'}, + {version: '4.4', date: 'January 2023', anchor: 'v442'}, + {version: '4.3', date: 'December 2022', anchor: 'v431'}, + {version: '4.2', date: 'November 2022', anchor: 'v421'}, + {version: '4.1', date: 'October 2022', anchor: 'v413'}, + {version: '4.0', date: 'September 2022', anchor: 'v401'}, + { + version: '3.43', + date: 'August 2022', + url: 'https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3432' + }, + { + version: '3.42', + date: 'July 2022', + url: 'https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3422' + }, + { + version: '3.41', + date: 'June 2022', + url: 'https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3422' + }, + { + version: '3.40', + date: 'May 2022', + url: 'https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3402' + }, + { + version: '3.39', + date: 'April 2022', + url: 'https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3391' + }, + { + version: '3.38', + date: 'March 2022', + url: 'https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3391' + }, + { + version: '3.37', + date: 'February 2022', + url: 'https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3391' + }, + { + version: '3.36', + date: 'January 2022', + url: 'https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3363' + }, + { + version: '3.35', + date: 'December 2021', + url: 'https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3352' + }, + { + version: '3.34', + date: 'November 2021', + url: 'https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3352' + }, + { + version: '3.33', + date: 'October 2021', + url: 'https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3332' + }, + { + version: '3.32', + date: 'September 2021', + url: 'https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3321' + }, + { + version: '3.31', + date: 'August 2021', + url: 'https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3321' + }, + { + version: '3.30', + date: 'July 2021', + url: 'https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3321' + }, + { + version: '3.29', + date: 'June 2021', + url: 'https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/CHANGELOG.md#3321' + } + ]; + + return ( +
+ + + + + + + + + + + {deprecatedReleases.map(release => ( + + + + + + + ))} + +
+ Release + + General Availability Date + + Supported + + Release Notes +
{release.version}{release.date} + + Notes + +
+
+ ); +} From ab213cae317a05462867b80dda5a4d0c49b512c7 Mon Sep 17 00:00:00 2001 From: Erik Seliger Date: Thu, 27 Nov 2025 00:01:58 +0100 Subject: [PATCH 2/2] Server-side API --- src/app/api/releases/route.ts | 20 ++++++++++++++++++++ src/components/ReleasesTable.tsx | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 src/app/api/releases/route.ts diff --git a/src/app/api/releases/route.ts b/src/app/api/releases/route.ts new file mode 100644 index 000000000..388df1323 --- /dev/null +++ b/src/app/api/releases/route.ts @@ -0,0 +1,20 @@ +import {NextResponse} from 'next/server'; + +// This endpoint proxies the release registry to not require access to another domain +// when visiting sourcegraph.com/docs. This might help some customers with strict firewalls. +export async function GET() { + const res = await fetch( + 'https://releaseregistry.sourcegraph.com/v1/releases/sourcegraph', + {next: {revalidate: 300}} + ); + + if (!res.ok) { + return NextResponse.json( + {error: 'Failed to fetch releases'}, + {status: 500} + ); + } + + const data = await res.json(); + return NextResponse.json(data); +} diff --git a/src/components/ReleasesTable.tsx b/src/components/ReleasesTable.tsx index daedf22f3..75e8ce648 100644 --- a/src/components/ReleasesTable.tsx +++ b/src/components/ReleasesTable.tsx @@ -62,7 +62,7 @@ export function SupportedReleasesTable() { const [error, setError] = useState(null); useEffect(() => { - fetch('https://releaseregistry.sourcegraph.com/v1/releases/sourcegraph') + fetch('/api/releases') .then(res => { if (!res.ok) throw new Error('Failed to fetch releases'); return res.json();