From fe85e05ba97da3cf3d346dd1cb93ce1b692e22e9 Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Thu, 13 Jun 2024 09:37:46 +0200 Subject: [PATCH] tools: fix c-ares update script PR-URL: https://github.com/nodejs/node/pull/53414 Fixes: https://github.com/nodejs/node/issues/53407 Reviewed-By: Richard Lau Reviewed-By: Rafael Gonzaga Reviewed-By: Luigi Pinca --- tools/dep_updaters/update-c-ares.sh | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/tools/dep_updaters/update-c-ares.sh b/tools/dep_updaters/update-c-ares.sh index bf20f5b25f9c7d..66d37ba350c246 100755 --- a/tools/dep_updaters/update-c-ares.sh +++ b/tools/dep_updaters/update-c-ares.sh @@ -11,7 +11,7 @@ DEPS_DIR="$BASE_DIR/deps" # shellcheck disable=SC1091 . "$BASE_DIR/tools/dep_updaters/utils.sh" -NEW_VERSION="$("$NODE" --input-type=module <<'EOF' +NEW_VERSION_METADATA="$("$NODE" --input-type=module <<'EOF' const res = await fetch('https://api.github.com/repos/c-ares/c-ares/releases/latest', process.env.GITHUB_TOKEN && { headers: { @@ -19,11 +19,17 @@ const res = await fetch('https://api.github.com/repos/c-ares/c-ares/releases/lat }, }); if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); -const { tag_name } = await res.json(); -console.log(tag_name.replace('cares-', '').replaceAll('_', '.')); +const { tag_name, assets } = await res.json(); +const { browser_download_url, name } = assets.find(({ name }) => name.endsWith('.tar.gz')); +if(!browser_download_url || !name) throw new Error('No tarball found'); +console.log(`${tag_name} ${browser_download_url} ${name}`); EOF )" +IFS=' ' read -r NEW_VERSION NEW_VERSION_URL ARES_TARBALL <