Trying a first version.
Some checks failed
Try out action / pre-commit Autoupdate (push) Failing after 33s
Lint / pre-commit Autoupdate (push) Failing after 41s

This commit is contained in:
2024-05-28 22:09:02 +02:00
parent fd6e50aa13
commit c3b63b7fea
301 changed files with 38323 additions and 17 deletions

View File

@ -18,33 +18,48 @@ function parseVersion(str){
}
async function increase_version_part(url, version, version_part) {
while (True) {
let url_with_version = "";
if (url_with_version == url) {
async function increaseVersionPart(url_pattern, version, version_part) {
let test_vor_existence = version;
while (true) {
const url_with_version = url_pattern.replace(/{{VERSION}}/g, test_vor_existence);
if (url_with_version == url_pattern) {
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`
let status = await fetch(url_with_version, {
method: "GET",
}).then((response) => response.status);
if (status === 200) {
version = test_vor_existence;
const version_parsed = parseVersion(test_vor_existence)
if (version_part == "minor") {
test_vor_existence = `${version_parsed.major}.${version_parsed.minor + 1}.0`;
} else if (version_part == "micro") {
test_vor_existence = `${existing_version.major}.${existing_version.minor}.${existing_version.micro + 1}`
test_vor_existence = `${version_parsed.major}.${version_parsed.minor}.${version_parsed.patch + 1}`;
} else {
throw new Error('The url does not contain an {{VERSION}} marker!');
}
} else {
return `${existing_version.major}.${existing_version.minor}.${existing_version.micro}`
return version
}
}
}
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"))
async function increaseVersion(url_pattern, version) {
let minor = await increaseVersionPart(url_pattern, version, version_part="minor");
return await increaseVersionPart(url_pattern, minor, version_part="micro");
}
increase_version()
async function main(){
try {
const url_pattern = core.getInput("url-pattern");
const start_version = core.getInput("start-version");
const current_version = await increaseVersion(url_pattern, start_version);
core.info(`The new version determend is ${current_version}`);
core.setOutput('max_version', current_version);
return current_version;
} catch (error) {
core.setFailed(`Action failed with error: ${error}`);
}
}
main();