From 0ef7755dd1dc92c0cf2c20966d974748b65b0d78 Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Tue, 28 May 2024 20:32:53 +0200 Subject: [PATCH] Update index.js --- index.js | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 895c077..6014117 100644 --- a/index.js +++ b/index.js @@ -19,13 +19,30 @@ function parseVersion(str){ async function increase_version_part(url, version, version_part) { + while (True) { + let url_with_version = ""; + if (url_with_version == url) { + throw new Error('The url does not contain an {{VERSION}} marker!'); + } + results = fetch(url) + if results.ok: + existing_version = test_vor_existence + if version_type == "minor": + test_vor_existence = Version(`${existing_version.major}.${existing_version.minor + 1}.0`) + elif version_type == "micro": + test_vor_existence = Version(`${existing_version.major}.${existing_version.minor}.${existing_version.micro + 1}`) + else: + raise ValueError() + else: + return existing_version + } } async function increase_version() { - url="https://dl.gitea.com/act_runner/{{VERSION}}/act_runner-{{VERSION}}-linux-arm-7" - version= "0.1.1" - minor = _increment_version_part(url, version, version_part="minor") + let url="https://dl.gitea.com/act_runner/{{VERSION}}/act_runner-{{VERSION}}-linux-arm-7" + let version = "0.1.1" + let minor = _increment_version_part(url, version, version_part="minor") return str(_increment_version_part(url, minor, version_part="micro")) }