forked from s1lvax/route
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request s1lvax#63 from Discusser/feature/autoupdate-versio…
…n-label Retrieve version from release tag name for index page
- Loading branch information
Showing
4 changed files
with
54 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "connekt", | ||
"version": "0.0.1", | ||
"version": "1.0.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "vite dev", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export const getReleaseVersion = async () => { | ||
const repository = 's1lvax/route'; | ||
let releaseVersion: string | null = null; | ||
|
||
// If we are unable to retrieve the release version for some reason, we can continue, and ensure that it's not | ||
// displayed in components by setting it to null and letting the components handle conditional rendering | ||
try { | ||
const response = await fetch(`https://api.github.com/repos/${repository}/releases`); | ||
if (response.ok) { | ||
releaseVersion = 'v' + (await response.json())[0].tag_name; | ||
} | ||
} catch { | ||
console.error(`Failed to fetch release info for ${repository}`); | ||
} | ||
|
||
return releaseVersion; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters