Initiated the action. #1
31
index.js
31
index.js
@ -9,11 +9,11 @@ function parseVersion(str){
|
|||||||
// parse int or default to 0
|
// parse int or default to 0
|
||||||
var maj = parseInt(arr[0]) || 0;
|
var maj = parseInt(arr[0]) || 0;
|
||||||
var min = parseInt(arr[1]) || 0;
|
var min = parseInt(arr[1]) || 0;
|
||||||
var rest = parseInt(arr[2]) || 0;
|
var patch = parseInt(arr[2]) || 0;
|
||||||
return {
|
return {
|
||||||
major: maj,
|
major: maj,
|
||||||
minor: min,
|
minor: min,
|
||||||
build: micro
|
patch: patch
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,25 +25,26 @@ async function increase_version_part(url, version, version_part) {
|
|||||||
throw new Error('The url does not contain an {{VERSION}} marker!');
|
throw new Error('The url does not contain an {{VERSION}} marker!');
|
||||||
}
|
}
|
||||||
results = fetch(url)
|
results = fetch(url)
|
||||||
if results.ok:
|
if (results.status == 200) {
|
||||||
existing_version = test_vor_existence
|
version_part = parseVersion(test_vor_existence)
|
||||||
if version_type == "minor":
|
if (version_type == "minor") {
|
||||||
test_vor_existence = Version(`${existing_version.major}.${existing_version.minor + 1}.0`)
|
test_vor_existence = `${existing_version.major}.${existing_version.minor + 1}.0`
|
||||||
elif version_type == "micro":
|
} else if (version_part == "micro") {
|
||||||
test_vor_existence = Version(`${existing_version.major}.${existing_version.minor}.${existing_version.micro + 1}`)
|
test_vor_existence = `${existing_version.major}.${existing_version.minor}.${existing_version.micro + 1}`
|
||||||
else:
|
} else {
|
||||||
raise ValueError()
|
throw new Error('The url does not contain an {{VERSION}} marker!');
|
||||||
else:
|
}
|
||||||
return existing_version
|
} else {
|
||||||
|
return `${existing_version.major}.${existing_version.minor}.${existing_version.micro}`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function increase_version() {
|
async function increase_version() {
|
||||||
let url="https://dl.gitea.com/act_runner/{{VERSION}}/act_runner-{{VERSION}}-linux-arm-7"
|
let url="https://dl.gitea.com/act_runner/{{VERSION}}/act_runner-{{VERSION}}-linux-arm-7"
|
||||||
let version = "0.1.1"
|
let version = "0.1.1"
|
||||||
let minor = _increment_version_part(url, version, version_part="minor")
|
let minor = increase_version_part(url, version, version_part="minor")
|
||||||
return str(_increment_version_part(url, minor, version_part="micro"))
|
return str(increase_version_part(url, minor, version_part="micro"))
|
||||||
}
|
}
|
||||||
|
|
||||||
increase_version()
|
increase_version()
|
Loading…
x
Reference in New Issue
Block a user