diff --git a/action.yml b/action.yml index 4aea4f0..c700265 100644 --- a/action.yml +++ b/action.yml @@ -9,7 +9,6 @@ inputs: version: description: 'Version of bwenv to set up. Default is latest.' required: false - default: 'latest' outputs: path: diff --git a/dist/main.cjs b/dist/main.cjs index 64a6bd5..1d6d23a 100644 --- a/dist/main.cjs +++ b/dist/main.cjs @@ -22401,11 +22401,14 @@ async function unzipArchive(archive, destination = __dirname2, deleteAfter = fal } async function run() { try { - const inputVersion = core.getInput("version", { required: false }); - const configVersion = await getVersionFromConfigFile(); - const availableVersions = await getAvailableVersions(); - const matchingVersion = findLatestMatchingVersion(availableVersions, configVersion); - const version2 = inputVersion || matchingVersion || "latest"; + const version2 = core.getInput("version", { required: false }) || await (async () => { + const configVersion = await getVersionFromConfigFile(); + const availableVersions = await getAvailableVersions(); + const matchingVersion = findLatestMatchingVersion(availableVersions, configVersion); + if (!matchingVersion) + throw new Error(`No version matching ${configVersion} found.`); + return matchingVersion; + })(); core.info(`Using Version: ${version2}`); const releaseURL = await getReleaseURL(version2); await downloadFile(releaseURL, path.join(__dirname2, "bwenv.zip")).then( diff --git a/src/main.ts b/src/main.ts index a26429f..108ff14 100644 --- a/src/main.ts +++ b/src/main.ts @@ -183,14 +183,15 @@ async function unzipArchive( async function run() { try { - const inputVersion = core.getInput('version', { required: false }); - - const configVersion = await getVersionFromConfigFile(); - const availableVersions = await getAvailableVersions(); - const matchingVersion = findLatestMatchingVersion(availableVersions, configVersion); - - const version = inputVersion || matchingVersion || 'latest'; - + const version = + core.getInput('version', { required: false }) || + (await (async () => { + const configVersion = await getVersionFromConfigFile(); + const availableVersions = await getAvailableVersions(); + const matchingVersion = findLatestMatchingVersion(availableVersions, configVersion); + if (!matchingVersion) throw new Error(`No version matching ${configVersion} found.`); + return matchingVersion; + })()); core.info(`Using Version: ${version}`); const releaseURL = await getReleaseURL(version);