From 845c6e11897706891aa87d7cfd0e77cf67125067 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Fri, 20 Dec 2024 16:42:20 +0800 Subject: [PATCH] Fix release script issue (#5459) --- extra/release/lib.mjs | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/extra/release/lib.mjs b/extra/release/lib.mjs index cd06cd37..81b9f11b 100644 --- a/extra/release/lib.mjs +++ b/extra/release/lib.mjs @@ -101,12 +101,30 @@ export function buildImage(repoNames, tags, target, buildArgs = "", dockerfile = /** * Check if the version already exists on Docker Hub * TODO: use semver to compare versions if it is greater than the previous? - * @param {string} repoName Docker Hub repository name + * @param {string[]} repoNames repository name (Only check the name with single slash) * @param {string} version Version to check * @returns {void} */ -export async function checkTagExists(repoName, version) { - console.log(`Checking if version ${version} exists on Docker Hub`); +export async function checkTagExists(repoNames, version) { + // Skip if the tag is not on Docker Hub + // louislam/uptime-kuma + let dockerHubRepoNames = repoNames.filter((name) => { + return name.split("/").length === 2; + }); + + for (let repoName of dockerHubRepoNames) { + await checkTagExistsSingle(repoName, version); + } +} + +/** + * Check if the version already exists on Docker Hub + * @param {string} repoName repository name + * @param {string} version Version to check + * @returns {Promise} + */ +export async function checkTagExistsSingle(repoName, version) { + console.log(`Checking if version ${version} exists on Docker Hub:`, repoName); // Get a list of tags from the Docker Hub repository let tags = [];