Skip to content

Commit

Permalink
ci: provide version info in docs (#1652)
Browse files Browse the repository at this point in the history
  • Loading branch information
gotbadger authored Jul 15, 2024
1 parent fa94098 commit 292f365
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/_data/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = async function () {
// type: "json",
// });
let release = {}
let rulesRelease = {}
try {
release = await EleventyFetch(
"https://api.github.com/repos/bearer/bearer/releases/latest",
Expand All @@ -16,12 +17,32 @@ module.exports = async function () {
)
} catch (err) {
console.log("Could not fetch release")
if (process.env.ELEVENTY_PRODUCTION) {
throw err
}
}
try {
rulesRelease = await EleventyFetch(
"https://api.github.com/repos/bearer/bearer-rules/releases/latest",
{
duration: "60m",
type: "json",
},
)
} catch (err) {
console.log("Could not fetch rulesRelease")
if (process.env.ELEVENTY_PRODUCTION) {
throw err
}
}
return {
// stargazers: repo.stargazers_count,
release: {
name: release.tag_name || "DEV",
url: release.html_url || "/",
},
rules: {
name: rulesRelease.tag_name || "DEV_RULES",
},
}
}
9 changes: 9 additions & 0 deletions docs/version.json.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
permalink: '/version.json'
eleventyExcludeFromCollections: true
layout: false
---
{
"binary": "{{ github.release.name }}",
"rules": "{{ github.rules.name }}"
}

0 comments on commit 292f365

Please sign in to comment.