website: Render versions under /data/versions.json (#7783)

This will facilitate other sites checking the current version of the OPA
website.

Signed-off-by: Charlie Egan <charlie@styra.com>
This commit is contained in:
Charlie Egan
2025-07-17 12:10:25 +01:00
committed by GitHub
parent 47f764e5be
commit 9c3bcbe4fd
3 changed files with 19 additions and 0 deletions
+3
View File
@@ -2,3 +2,6 @@
build
node_modules*
package-lock.json
# this is generated by the build process
static/data/versions.json
+7
View File
@@ -445,6 +445,13 @@ The Linux Foundation has registered trademarks and uses trademarks. For a list o
const { versions } = content;
await createData("versions.json", JSON.stringify(versions, null, 2));
const staticDir = path.join(context.siteDir, "static", "data");
await fs.mkdir(staticDir, { recursive: true });
await fs.writeFile(
path.join(staticDir, "versions.json"),
JSON.stringify(versions, null, 2),
);
},
};
},
+9
View File
@@ -20,3 +20,12 @@ function = "badge"
[[edge_functions]]
path = "/docs/*"
function = "version-redirect"
# /data/versions.json is used by versioned OPA deployments to determine
# if what the latest release is, how outdated they are.
[[headers]]
for = "/data/versions.json"
[headers.values]
Access-Control-Allow-Origin = "https://*.netlify.app"
Access-Control-Allow-Methods = "GET, OPTIONS"
Access-Control-Allow-Headers = "Content-Type"