mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
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:
@@ -2,3 +2,6 @@
|
||||
build
|
||||
node_modules*
|
||||
package-lock.json
|
||||
|
||||
# this is generated by the build process
|
||||
static/data/versions.json
|
||||
|
||||
@@ -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),
|
||||
);
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user