diff --git a/packages/builder/src/pages/builder/portal/settings/version.svelte b/packages/builder/src/pages/builder/portal/settings/version.svelte
index 694475edcc..c9b2f618e3 100644
--- a/packages/builder/src/pages/builder/portal/settings/version.svelte
+++ b/packages/builder/src/pages/builder/portal/settings/version.svelte
@@ -8,6 +8,8 @@
Divider,
notifications,
Label,
+ Modal,
+ ModalContent,
} from "@budibase/bbui"
import { API } from "api"
import { auth, admin } from "stores/portal"
@@ -15,6 +17,11 @@
let version
let loaded = false
+ let githubVersion
+ let githubPublishedDate
+ let githubPublishedTime
+ let needsUpdate = true
+ let updateModal
// Only admins allowed here
$: {
@@ -47,8 +54,37 @@
}
}
+ async function getLatestVersion() {
+ try {
+ //Check github API for the latest release
+ const githubCheck = await fetch(
+ "https://api.github.com/repos/Budibase/budibase/releases/latest"
+ )
+ const githubResponse = await githubCheck.json()
+
+ //Get tag and remove the v infront of the tage name e.g. v1.0.0 is 1.0.0
+ githubVersion = githubResponse.tag_name.slice(1)
+
+ //Get the release date and output it in the local time format
+ githubPublishedDate = new Date(githubResponse.published_at)
+ githubPublishedTime = githubPublishedDate.toLocaleTimeString()
+ githubPublishedDate = githubPublishedDate.toLocaleDateString()
+
+ //Does Budibase need to be updated?
+ if (githubVersion === version) {
+ needsUpdate = false
+ } else {
+ needsUpdate = true
+ }
+ } catch (error) {
+ notifications.error("Error getting the latest Budibase version")
+ githubVersion = null
+ }
+ }
+
onMount(async () => {
await getVersion()
+ await getLatestVersion()
loaded = true
})
@@ -69,9 +105,32 @@