const core = require("@actions/core"); function parseVersion(str){ if (typeof(str) != 'string') { return false; } var arr = str.split('.'); // parse int or default to 0 var maj = parseInt(arr[0]) || 0; var min = parseInt(arr[1]) || 0; var patch = parseInt(arr[2]) || 0; return { major: maj, minor: min, patch: patch } } 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.status == 200) { version_part = parseVersion(test_vor_existence) if (version_type == "minor") { test_vor_existence = `${existing_version.major}.${existing_version.minor + 1}.0` } else if (version_part == "micro") { test_vor_existence = `${existing_version.major}.${existing_version.minor}.${existing_version.micro + 1}` } else { throw new Error('The url does not contain an {{VERSION}} marker!'); } } else { return `${existing_version.major}.${existing_version.minor}.${existing_version.micro}` } } } async function increase_version() { let url="https://dl.gitea.com/act_runner/{{VERSION}}/act_runner-{{VERSION}}-linux-arm-7" let version = "0.1.1" let minor = increase_version_part(url, version, version_part="minor") return str(increase_version_part(url, minor, version_part="micro")) } increase_version()