From e9d82b52d6ea8799a9272a11836d78b7e584f741 Mon Sep 17 00:00:00 2001 From: Sthope Date: Mon, 28 Aug 2023 19:05:55 +0200 Subject: [PATCH] Add tools/check_version.js --- tools/check_version.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tools/check_version.js diff --git a/tools/check_version.js b/tools/check_version.js new file mode 100644 index 0000000..4f2cf39 --- /dev/null +++ b/tools/check_version.js @@ -0,0 +1,24 @@ +const axios = require("axios"); + +function getLatestReleaseTag() { + return axios + .get(`https://api.github.com/repos/insignia-live/setup-assistant-release/releases/latest`) + .then((response) => response.data.tag_name) + .catch((error) => { + console.error("Error fetching latest release tag:", error.message); + return "0.0.0"; // Return a default value in case of an error + }); +} + +getLatestReleaseTag().then((latestReleaseTag) => { + const targetReleaseTag = "2023-02-13-1223"; // Replace with your target release tag + + // Compare release tags as strings + if (latestReleaseTag > targetReleaseTag) { + console.log("This pipeline is run because the new release is newer than the one I have."); + } else if (latestReleaseTag === targetReleaseTag) { + console.log("The release tag is the same as the target tag."); + } else { + console.log("The new release is older than the one I have."); + } +});