From bfaa7ffd65db69456f8689c6c7fbe778a2bc804a Mon Sep 17 00:00:00 2001 From: Ruud Senden <8635138+rsenden@users.noreply.github.com> Date: Thu, 26 Oct 2023 17:53:38 +0200 Subject: [PATCH] chore: Attempt to fix fcli version aliases --- setup/dist/index.js | 12 +++++++----- setup/src/setup.ts | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/setup/dist/index.js b/setup/dist/index.js index 64f7998..8267a06 100644 --- a/setup/dist/index.js +++ b/setup/dist/index.js @@ -6668,11 +6668,13 @@ const FCLI_SHA256 = { function updateFcliVersionAliases() { for (const slug in FCLI_SHA256) { const version = slug.substring(0, slug.indexOf('/')); - const alias1 = version.substring(0, version.indexOf('.')); - const alias2 = version.substring(0, version.lastIndexOf('.')); - core.info(`${version} (${slug}) aliases: ${alias1} ${alias2}`); - TOOLS["fcli"]["versionAliases"][alias1] = version; - TOOLS["fcli"]["versionAliases"][alias2] = version; + const minorAlias = version.substring(0, version.lastIndexOf('.')); + const majorAlias = version.substring(0, version.indexOf('.')); + if (!TOOLS["fcli"]["versionAliases"][minorAlias]) { + core.info(`${version} (${slug}) aliases: ${minorAlias} ${majorAlias}`); + TOOLS["fcli"]["versionAliases"][minorAlias] = version; + TOOLS["fcli"]["versionAliases"][majorAlias] = version; + } } } /** diff --git a/setup/src/setup.ts b/setup/src/setup.ts index af60a38..8c8195c 100644 --- a/setup/src/setup.ts +++ b/setup/src/setup.ts @@ -84,11 +84,13 @@ const FCLI_SHA256: Record = { function updateFcliVersionAliases() { for ( const slug in FCLI_SHA256 ) { const version = slug.substring(0, slug.indexOf('/')); - const alias1 = version.substring(0, version.indexOf('.')); - const alias2 = version.substring(0, version.lastIndexOf('.')); - core.info(`${version} (${slug}) aliases: ${alias1} ${alias2}`); - TOOLS["fcli"]["versionAliases"][alias1] = version; - TOOLS["fcli"]["versionAliases"][alias2] = version; + const minorAlias = version.substring(0, version.lastIndexOf('.')); + const majorAlias = version.substring(0, version.indexOf('.')); + if (!TOOLS["fcli"]["versionAliases"][minorAlias]) { + core.info(`${version} (${slug}) aliases: ${minorAlias} ${majorAlias}`); + TOOLS["fcli"]["versionAliases"][minorAlias] = version; + TOOLS["fcli"]["versionAliases"][majorAlias] = version; + } } }