From 7674d5f3bd71989a9204f87c533d75a445322072 Mon Sep 17 00:00:00 2001 From: Tony Gorez Date: Fri, 3 Feb 2023 16:07:07 +0100 Subject: [PATCH 01/19] tools: refactor dep_updaters --- .github/workflows/tools.yml | 28 +++------------------------ tools/dep_updaters/update-eslint.sh | 8 ++++++++ tools/dep_updaters/update-libuv.sh | 27 +++++++++++++++++++------- tools/dep_updaters/update-postject.sh | 9 +++++++++ tools/dep_updaters/update-simdutf.sh | 20 ++++++++++++------- 5 files changed, 53 insertions(+), 39 deletions(-) diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index e92a2e787a7b91..2155d1389981e3 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -20,13 +20,7 @@ jobs: - id: eslint subsystem: tools label: tools - run: | - NEW_VERSION=$(npm view eslint dist-tags.latest) - CURRENT_VERSION=$(node -p "require('./tools/node_modules/eslint/package.json').version") - if [ "$NEW_VERSION" != "$CURRENT_VERSION" ]; then - echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV - ./tools/dep_updaters/update-eslint.sh - fi + run: ./tools/dep_updaters/update-eslint.sh - id: corepack subsystem: deps label: dependencies @@ -80,13 +74,7 @@ jobs: - id: postject subsystem: deps,test label: test - run: | - NEW_VERSION=$(npm view postject dist-tags.latest) - CURRENT_VERSION=$(node -p "require('./test/fixtures/postject-copy/node_modules/postject/package.json').version") - if [ "$NEW_VERSION" != "$CURRENT_VERSION" ]; then - echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV - ./tools/dep_updaters/update-postject.sh - fi + run: ./tools/dep_updaters/update-postject.sh - id: base64 subsystem: deps label: dependencies @@ -123,17 +111,7 @@ jobs: label: dependencies run: | NEW_VERSION=$(gh api repos/libuv/libuv/releases/latest -q '.tag_name|ltrimstr("v")') - VERSION_H="./deps/uv/include/uv/version.h" - CURRENT_MAJOR_VERSION=$(grep "#define UV_VERSION_MAJOR" $VERSION_H | sed -n "s/^.*MAJOR \(.*\)/\1/p") - CURRENT_MINOR_VERSION=$(grep "#define UV_VERSION_MINOR" $VERSION_H | sed -n "s/^.*MINOR \(.*\)/\1/p") - CURRENT_PATCH_VERSION=$(grep "#define UV_VERSION_PATCH" $VERSION_H | sed -n "s/^.*PATCH \(.*\)/\1/p") - CURRENT_SUFFIX_VERSION=$(grep "#define UV_VERSION_SUFFIX" $VERSION_H | sed -n "s/^.*SUFFIX \"\(.*\)\"/\1/p") - SUFFIX_STRING=$([[ -z "$CURRENT_SUFFIX_VERSION" ]] && echo "" || echo "-$CURRENT_SUFFIX_VERSION") - CURRENT_VERSION="$CURRENT_MAJOR_VERSION.$CURRENT_MINOR_VERSION.$CURRENT_PATCH_VERSION$SUFFIX_STRING" - if [ "$NEW_VERSION" != "$CURRENT_VERSION" ]; then - echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV - ./tools/dep_updaters/update-libuv.sh "$NEW_VERSION" - fi + ./tools/dep_updaters/update-libuv.sh "$NEW_VERSION" - id: simdutf subsystem: deps label: dependencies diff --git a/tools/dep_updaters/update-eslint.sh b/tools/dep_updaters/update-eslint.sh index 7d536ef50212ab..34640cc8356142 100755 --- a/tools/dep_updaters/update-eslint.sh +++ b/tools/dep_updaters/update-eslint.sh @@ -7,6 +7,14 @@ set -ex +NEW_VERSION=$(npm view eslint dist-tags.latest) +CURRENT_VERSION=$(node -p "require('./tools/node_modules/eslint/package.json').version") + +if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then + echo "Skipped because ESlint is on the latest version." + exit 0 +fi + cd "$( dirname "$0" )" || exit rm -rf ../node_modules/eslint ( diff --git a/tools/dep_updaters/update-libuv.sh b/tools/dep_updaters/update-libuv.sh index ae7fe9a76cac4e..6aa184ecfc3e1a 100755 --- a/tools/dep_updaters/update-libuv.sh +++ b/tools/dep_updaters/update-libuv.sh @@ -2,16 +2,29 @@ set -e # Shell script to update libuv in the source tree to a specific version -BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd) -DEPS_DIR="$BASE_DIR/deps" -LIBUV_VERSION=$1 - if [ "$#" -le 0 ]; then - echo "Error: please provide an libuv version to update to" + echo "Error: please provide an libuv version to update" echo " e.g. $0 1.44.2" exit 1 fi +BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd) +DEPS_DIR="$BASE_DIR/deps" + +NEW_VERSION=$1 +VERSION_H="$DEPS_DIR/uv/include/uv/version.h" +CURRENT_MAJOR_VERSION=$(grep "#define UV_VERSION_MAJOR" $VERSION_H | sed -n "s/^.*MAJOR \(.*\)/\1/p") +CURRENT_MINOR_VERSION=$(grep "#define UV_VERSION_MINOR" $VERSION_H | sed -n "s/^.*MINOR \(.*\)/\1/p") +CURRENT_PATCH_VERSION=$(grep "#define UV_VERSION_PATCH" $VERSION_H | sed -n "s/^.*PATCH \(.*\)/\1/p") +CURRENT_SUFFIX_VERSION=$(grep "#define UV_VERSION_SUFFIX" $VERSION_H | sed -n "s/^.*SUFFIX \"\(.*\)\"/\1/p") +SUFFIX_STRING=$([[ -z "$CURRENT_SUFFIX_VERSION" ]] && echo "" || echo "-$CURRENT_SUFFIX_VERSION") +CURRENT_VERSION="$CURRENT_MAJOR_VERSION.$CURRENT_MINOR_VERSION.$CURRENT_PATCH_VERSION$SUFFIX_STRING" + +if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then + echo "Skipped because libuv is on the latest version." + exit 0 +fi + echo "Making temporary workspace..." WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp') @@ -27,7 +40,7 @@ trap cleanup INT TERM EXIT cd "$WORKSPACE" echo "Fetching libuv source archive..." -curl -sL "https://api.github.com/repos/libuv/libuv/tarball/v$LIBUV_VERSION" | tar xzf - +curl -sL "https://api.github.com/repos/libuv/libuv/tarball/v$NEW_VERSION" | tar xzf - mv libuv-libuv-* uv echo "Replacing existing libuv (except GYP build files)" @@ -40,5 +53,5 @@ echo "" echo "Please git add uv, commit the new version:" echo "" echo "$ git add -A deps/uv" -echo "$ git commit -m \"deps: update libuv to $LIBUV_VERSION\"" +echo "$ git commit -m \"deps: update libuv to $NEW_VERSION\"" echo "" diff --git a/tools/dep_updaters/update-postject.sh b/tools/dep_updaters/update-postject.sh index 66b207f9666636..03a7f8352947e1 100755 --- a/tools/dep_updaters/update-postject.sh +++ b/tools/dep_updaters/update-postject.sh @@ -7,6 +7,15 @@ set -ex +NEW_VERSION=$(npm view postject dist-tags.latest) +CURRENT_VERSION=$(node -p "require('./test/fixtures/postject-copy/node_modules/postject/package.json').version") + +if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then + echo "Skipped because Postject is on the latest version." + exit 0 +fi + +echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV cd "$( dirname "$0" )/../.." || exit rm -rf test/fixtures/postject-copy mkdir test/fixtures/postject-copy diff --git a/tools/dep_updaters/update-simdutf.sh b/tools/dep_updaters/update-simdutf.sh index d502558b474479..f4c40ef127728d 100755 --- a/tools/dep_updaters/update-simdutf.sh +++ b/tools/dep_updaters/update-simdutf.sh @@ -2,16 +2,22 @@ set -e # Shell script to update simdutf in the source tree to a specific version -BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd) -DEPS_DIR="$BASE_DIR/deps" -SIMDUTF_VERSION=$1 - if [ "$#" -le 0 ]; then echo "Error: please provide an simdutf version to update to" echo " e.g. $0 2.0.3" exit 1 fi +BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd) +DEPS_DIR="$BASE_DIR/deps" +NEW_VERSION=$1 +CURRENT_VERSION=$(grep "#define SIMDUTF_VERSION" "$DEPS_DIR/simdutf/simdutf.h" | sed -n "s/^.*VERSION \"\(.*\)\"/\1/p") + +if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then + echo "Skipped because simdutf is on the latest version." + exit 0 +fi + echo "Making temporary workspace..." WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp') @@ -24,8 +30,8 @@ cleanup () { trap cleanup INT TERM EXIT -SIMDUTF_REF="v$SIMDUTF_VERSION" -SIMDUTF_ZIP="simdutf-$SIMDUTF_VERSION.zip" +SIMDUTF_REF="v$NEW_VERSION" +SIMDUTF_ZIP="simdutf-$NEW_VERSION.zip" SIMDUTF_LICENSE="LICENSE-MIT" cd "$WORKSPACE" @@ -48,5 +54,5 @@ echo "" echo "Please git add simdutf, commit the new version:" echo "" echo "$ git add -A deps/simdutf" -echo "$ git commit -m \"deps: update simdutf to $SIMDUTF_VERSION\"" +echo "$ git commit -m \"deps: update simdutf to $NEW_VERSION\"" echo "" From ce94a5e9a16782ab33cb8dc1bf37202072c342ff Mon Sep 17 00:00:00 2001 From: Tony Gorez Date: Fri, 3 Feb 2023 17:12:20 +0100 Subject: [PATCH 02/19] tools: use $NPM and $NODE --- tools/dep_updaters/update-eslint.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tools/dep_updaters/update-eslint.sh b/tools/dep_updaters/update-eslint.sh index 34640cc8356142..fe0e027cd8e61d 100755 --- a/tools/dep_updaters/update-eslint.sh +++ b/tools/dep_updaters/update-eslint.sh @@ -7,8 +7,15 @@ set -ex -NEW_VERSION=$(npm view eslint dist-tags.latest) -CURRENT_VERSION=$(node -p "require('./tools/node_modules/eslint/package.json').version") +ROOT=$(cd "$(dirname "$0")/../.." && pwd) +DEPS_DIR="$ROOT/deps" + +[ -z "$NODE" ] && NODE="$ROOT/out/Release/node" +[ -x "$NODE" ] || NODE=$(command -v node) +NPM="$DEPS_DIR/npm/bin/npm-cli.js" + +NEW_VERSION=$("$NODE" "$NPM" view eslint dist-tags.latest) +CURRENT_VERSION=$("$NODE" -p "require('./tools/node_modules/eslint/package.json').version") if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then echo "Skipped because ESlint is on the latest version." @@ -22,11 +29,6 @@ rm -rf ../node_modules/eslint mkdir eslint-tmp cd eslint-tmp || exit - ROOT="$PWD/../../.." - [ -z "$NODE" ] && NODE="$ROOT/out/Release/node" - [ -x "$NODE" ] || NODE=$(command -v node) - NPM="$ROOT/deps/npm/bin/npm-cli.js" - "$NODE" "$NPM" init --yes "$NODE" "$NPM" install \ From 0572203211662bce9fd62d0c3707e3c99be8c614 Mon Sep 17 00:00:00 2001 From: Tony Gorez Date: Fri, 3 Feb 2023 17:15:31 +0100 Subject: [PATCH 03/19] tools: make postject and eslint uniform --- tools/dep_updaters/update-eslint.sh | 3 +-- tools/dep_updaters/update-postject.sh | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tools/dep_updaters/update-eslint.sh b/tools/dep_updaters/update-eslint.sh index fe0e027cd8e61d..209be8e0e173a8 100755 --- a/tools/dep_updaters/update-eslint.sh +++ b/tools/dep_updaters/update-eslint.sh @@ -8,11 +8,10 @@ set -ex ROOT=$(cd "$(dirname "$0")/../.." && pwd) -DEPS_DIR="$ROOT/deps" [ -z "$NODE" ] && NODE="$ROOT/out/Release/node" [ -x "$NODE" ] || NODE=$(command -v node) -NPM="$DEPS_DIR/npm/bin/npm-cli.js" +NPM="$ROOT/deps/npm/bin/npm-cli.js" NEW_VERSION=$("$NODE" "$NPM" view eslint dist-tags.latest) CURRENT_VERSION=$("$NODE" -p "require('./tools/node_modules/eslint/package.json').version") diff --git a/tools/dep_updaters/update-postject.sh b/tools/dep_updaters/update-postject.sh index 03a7f8352947e1..0b55f171739fe8 100755 --- a/tools/dep_updaters/update-postject.sh +++ b/tools/dep_updaters/update-postject.sh @@ -7,6 +7,11 @@ set -ex +ROOT=$(cd "$(dirname "$0")/../.." && pwd) +[ -z "$NODE" ] && NODE="$ROOT/out/Release/node" +[ -x "$NODE" ] || NODE=$(command -v node) +NPM="$ROOT/deps/npm/bin/npm-cli.js" + NEW_VERSION=$(npm view postject dist-tags.latest) CURRENT_VERSION=$(node -p "require('./test/fixtures/postject-copy/node_modules/postject/package.json').version") @@ -21,11 +26,6 @@ rm -rf test/fixtures/postject-copy mkdir test/fixtures/postject-copy cd test/fixtures/postject-copy || exit -ROOT="$PWD/../../.." -[ -z "$NODE" ] && NODE="$ROOT/out/Release/node" -[ -x "$NODE" ] || NODE=$(command -v node) -NPM="$ROOT/deps/npm/bin/npm-cli.js" - "$NODE" "$NPM" init --yes "$NODE" "$NPM" install --no-bin-links --ignore-scripts postject From 618670c98978c006647393604319aff86792d6ed Mon Sep 17 00:00:00 2001 From: Tony Gorez Date: Fri, 3 Feb 2023 20:09:50 +0100 Subject: [PATCH 04/19] fix: lib message --- tools/dep_updaters/update-libuv.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/dep_updaters/update-libuv.sh b/tools/dep_updaters/update-libuv.sh index 6aa184ecfc3e1a..17b3ec58063a1f 100755 --- a/tools/dep_updaters/update-libuv.sh +++ b/tools/dep_updaters/update-libuv.sh @@ -3,7 +3,7 @@ set -e # Shell script to update libuv in the source tree to a specific version if [ "$#" -le 0 ]; then - echo "Error: please provide an libuv version to update" + echo "Error: please provide an libuv version to update to" echo " e.g. $0 1.44.2" exit 1 fi From e25f57f0b8936f447188582a06a04907a72c80c3 Mon Sep 17 00:00:00 2001 From: Tony Gorez Date: Fri, 3 Feb 2023 20:13:00 +0100 Subject: [PATCH 05/19] tools: use quotes for handling spaces in $VERSION_H --- tools/dep_updaters/update-libuv.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/dep_updaters/update-libuv.sh b/tools/dep_updaters/update-libuv.sh index 17b3ec58063a1f..2211486e042dc0 100755 --- a/tools/dep_updaters/update-libuv.sh +++ b/tools/dep_updaters/update-libuv.sh @@ -13,10 +13,10 @@ DEPS_DIR="$BASE_DIR/deps" NEW_VERSION=$1 VERSION_H="$DEPS_DIR/uv/include/uv/version.h" -CURRENT_MAJOR_VERSION=$(grep "#define UV_VERSION_MAJOR" $VERSION_H | sed -n "s/^.*MAJOR \(.*\)/\1/p") -CURRENT_MINOR_VERSION=$(grep "#define UV_VERSION_MINOR" $VERSION_H | sed -n "s/^.*MINOR \(.*\)/\1/p") -CURRENT_PATCH_VERSION=$(grep "#define UV_VERSION_PATCH" $VERSION_H | sed -n "s/^.*PATCH \(.*\)/\1/p") -CURRENT_SUFFIX_VERSION=$(grep "#define UV_VERSION_SUFFIX" $VERSION_H | sed -n "s/^.*SUFFIX \"\(.*\)\"/\1/p") +CURRENT_MAJOR_VERSION=$(grep "#define UV_VERSION_MAJOR" "$VERSION_H" | sed -n "s/^.*MAJOR \(.*\)/\1/p") +CURRENT_MINOR_VERSION=$(grep "#define UV_VERSION_MINOR" "$VERSION_H" | sed -n "s/^.*MINOR \(.*\)/\1/p") +CURRENT_PATCH_VERSION=$(grep "#define UV_VERSION_PATCH" "$VERSION_H" | sed -n "s/^.*PATCH \(.*\)/\1/p") +CURRENT_SUFFIX_VERSION=$(grep "#define UV_VERSION_SUFFIX" "$VERSION_H" | sed -n "s/^.*SUFFIX \"\(.*\)\"/\1/p") SUFFIX_STRING=$([[ -z "$CURRENT_SUFFIX_VERSION" ]] && echo "" || echo "-$CURRENT_SUFFIX_VERSION") CURRENT_VERSION="$CURRENT_MAJOR_VERSION.$CURRENT_MINOR_VERSION.$CURRENT_PATCH_VERSION$SUFFIX_STRING" From b4491a7e75e282eb368601af481cdf487f04d81e Mon Sep 17 00:00:00 2001 From: Tony Gorez Date: Fri, 3 Feb 2023 20:15:40 +0100 Subject: [PATCH 06/19] tools: use $NODE and $NPM in postject script --- tools/dep_updaters/update-postject.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/dep_updaters/update-postject.sh b/tools/dep_updaters/update-postject.sh index 0b55f171739fe8..830daf4fc04dfa 100755 --- a/tools/dep_updaters/update-postject.sh +++ b/tools/dep_updaters/update-postject.sh @@ -12,8 +12,8 @@ ROOT=$(cd "$(dirname "$0")/../.." && pwd) [ -x "$NODE" ] || NODE=$(command -v node) NPM="$ROOT/deps/npm/bin/npm-cli.js" -NEW_VERSION=$(npm view postject dist-tags.latest) -CURRENT_VERSION=$(node -p "require('./test/fixtures/postject-copy/node_modules/postject/package.json').version") +NEW_VERSION=$("$NODE" "$NPM" view postject dist-tags.latest) +CURRENT_VERSION=$("$NODE" -p "require('./test/fixtures/postject-copy/node_modules/postject/package.json').version") if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then echo "Skipped because Postject is on the latest version." From f4b2297bae8fbc0bdc629571093628a8b4377444 Mon Sep 17 00:00:00 2001 From: Tony Gorez Date: Fri, 3 Feb 2023 20:27:18 +0100 Subject: [PATCH 07/19] fix: delete useless statement --- tools/dep_updaters/update-postject.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/dep_updaters/update-postject.sh b/tools/dep_updaters/update-postject.sh index 830daf4fc04dfa..b764a3370535b3 100755 --- a/tools/dep_updaters/update-postject.sh +++ b/tools/dep_updaters/update-postject.sh @@ -20,7 +20,6 @@ if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then exit 0 fi -echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV cd "$( dirname "$0" )/../.." || exit rm -rf test/fixtures/postject-copy mkdir test/fixtures/postject-copy From a175f130fe635ea3cf2d60bf005e0f9bc77d652a Mon Sep 17 00:00:00 2001 From: Tony Gorez Date: Fri, 3 Feb 2023 20:29:59 +0100 Subject: [PATCH 08/19] fix: make libuv script posix compliant --- tools/dep_updaters/update-libuv.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/dep_updaters/update-libuv.sh b/tools/dep_updaters/update-libuv.sh index 2211486e042dc0..fcb691acbf4efd 100755 --- a/tools/dep_updaters/update-libuv.sh +++ b/tools/dep_updaters/update-libuv.sh @@ -17,7 +17,7 @@ CURRENT_MAJOR_VERSION=$(grep "#define UV_VERSION_MAJOR" "$VERSION_H" | sed -n "s CURRENT_MINOR_VERSION=$(grep "#define UV_VERSION_MINOR" "$VERSION_H" | sed -n "s/^.*MINOR \(.*\)/\1/p") CURRENT_PATCH_VERSION=$(grep "#define UV_VERSION_PATCH" "$VERSION_H" | sed -n "s/^.*PATCH \(.*\)/\1/p") CURRENT_SUFFIX_VERSION=$(grep "#define UV_VERSION_SUFFIX" "$VERSION_H" | sed -n "s/^.*SUFFIX \"\(.*\)\"/\1/p") -SUFFIX_STRING=$([[ -z "$CURRENT_SUFFIX_VERSION" ]] && echo "" || echo "-$CURRENT_SUFFIX_VERSION") +SUFFIX_STRING=$([ -z "$CURRENT_SUFFIX_VERSION" ] && echo "" || echo "-$CURRENT_SUFFIX_VERSION") CURRENT_VERSION="$CURRENT_MAJOR_VERSION.$CURRENT_MINOR_VERSION.$CURRENT_PATCH_VERSION$SUFFIX_STRING" if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then From cd891eead64222dfd340f6ea55976f6d7f899a7e Mon Sep 17 00:00:00 2001 From: Tony Gorez Date: Sun, 5 Feb 2023 17:15:31 +0100 Subject: [PATCH 09/19] tools: use UV_IS_RELEASE --- tools/dep_updaters/update-libuv.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/dep_updaters/update-libuv.sh b/tools/dep_updaters/update-libuv.sh index fcb691acbf4efd..9c7b57e99b68c5 100755 --- a/tools/dep_updaters/update-libuv.sh +++ b/tools/dep_updaters/update-libuv.sh @@ -16,8 +16,9 @@ VERSION_H="$DEPS_DIR/uv/include/uv/version.h" CURRENT_MAJOR_VERSION=$(grep "#define UV_VERSION_MAJOR" "$VERSION_H" | sed -n "s/^.*MAJOR \(.*\)/\1/p") CURRENT_MINOR_VERSION=$(grep "#define UV_VERSION_MINOR" "$VERSION_H" | sed -n "s/^.*MINOR \(.*\)/\1/p") CURRENT_PATCH_VERSION=$(grep "#define UV_VERSION_PATCH" "$VERSION_H" | sed -n "s/^.*PATCH \(.*\)/\1/p") +CURRENT_IS_RELEASE=$(grep "#define UV_VERSION_IS_RELEASE" "$VERSION_H" | sed -n "s/^.*RELEASE \(.*\)/\1/p") CURRENT_SUFFIX_VERSION=$(grep "#define UV_VERSION_SUFFIX" "$VERSION_H" | sed -n "s/^.*SUFFIX \"\(.*\)\"/\1/p") -SUFFIX_STRING=$([ -z "$CURRENT_SUFFIX_VERSION" ] && echo "" || echo "-$CURRENT_SUFFIX_VERSION") +SUFFIX_STRING=$([ "$CURRENT_IS_RELEASE" = 1 ] || [ -z "$CURRENT_SUFFIX_VERSION" ] && echo "" || echo "-$CURRENT_SUFFIX_VERSION") CURRENT_VERSION="$CURRENT_MAJOR_VERSION.$CURRENT_MINOR_VERSION.$CURRENT_PATCH_VERSION$SUFFIX_STRING" if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then From 8437fb51626a9f2225e616860ad848e79f1f14b6 Mon Sep 17 00:00:00 2001 From: Tony Gorez Date: Wed, 8 Feb 2023 17:40:36 +0100 Subject: [PATCH 10/19] fix: add NEW_VERSION into GITHUB_ENV --- tools/dep_updaters/update-eslint.sh | 2 ++ tools/dep_updaters/update-libuv.sh | 2 ++ tools/dep_updaters/update-postject.sh | 2 ++ tools/dep_updaters/update-simdutf.sh | 2 ++ 4 files changed, 8 insertions(+) diff --git a/tools/dep_updaters/update-eslint.sh b/tools/dep_updaters/update-eslint.sh index 209be8e0e173a8..291ceee86d7c6b 100755 --- a/tools/dep_updaters/update-eslint.sh +++ b/tools/dep_updaters/update-eslint.sh @@ -21,6 +21,8 @@ if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then exit 0 fi +[ -f "$GITHUB_ENV" ] && echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV || echo "File GITHUB_ENV doesn't exist!" + cd "$( dirname "$0" )" || exit rm -rf ../node_modules/eslint ( diff --git a/tools/dep_updaters/update-libuv.sh b/tools/dep_updaters/update-libuv.sh index 9c7b57e99b68c5..6bf70e64934893 100755 --- a/tools/dep_updaters/update-libuv.sh +++ b/tools/dep_updaters/update-libuv.sh @@ -26,6 +26,8 @@ if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then exit 0 fi +[ -f "$GITHUB_ENV" ] && echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV || echo "File GITHUB_ENV doesn't exist!" + echo "Making temporary workspace..." WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp') diff --git a/tools/dep_updaters/update-postject.sh b/tools/dep_updaters/update-postject.sh index b764a3370535b3..fe9c6ffed2b5f1 100755 --- a/tools/dep_updaters/update-postject.sh +++ b/tools/dep_updaters/update-postject.sh @@ -20,6 +20,8 @@ if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then exit 0 fi +[ -f "$GITHUB_ENV" ] && echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV || echo "File GITHUB_ENV doesn't exist!" + cd "$( dirname "$0" )/../.." || exit rm -rf test/fixtures/postject-copy mkdir test/fixtures/postject-copy diff --git a/tools/dep_updaters/update-simdutf.sh b/tools/dep_updaters/update-simdutf.sh index f4c40ef127728d..6d0afa5f77259c 100755 --- a/tools/dep_updaters/update-simdutf.sh +++ b/tools/dep_updaters/update-simdutf.sh @@ -18,6 +18,8 @@ if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then exit 0 fi +[ -f "$GITHUB_ENV" ] && echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV || echo "File GITHUB_ENV doesn't exist!" + echo "Making temporary workspace..." WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp') From fda7d4c8907aacfb4661ded4c79b99e0009d2304 Mon Sep 17 00:00:00 2001 From: Tony Gorez Date: Wed, 8 Feb 2023 18:10:34 +0100 Subject: [PATCH 11/19] fix: put $GITHUB_ENV logic out off the script --- .github/workflows/tools.yml | 20 +++++++++++++++----- tools/dep_updaters/update-eslint.sh | 5 +++-- tools/dep_updaters/update-libuv.sh | 2 -- tools/dep_updaters/update-postject.sh | 5 +++-- tools/dep_updaters/update-simdutf.sh | 2 -- 5 files changed, 21 insertions(+), 13 deletions(-) diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 2155d1389981e3..3e193fc9ea6846 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -20,7 +20,11 @@ jobs: - id: eslint subsystem: tools label: tools - run: ./tools/dep_updaters/update-eslint.sh + run: | + NEW_VERSION=$(./tools/dep_updaters/update-eslint.sh | tail -n1) + if [ $? = 0 ]; then + echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV + fi - id: corepack subsystem: deps label: dependencies @@ -74,7 +78,11 @@ jobs: - id: postject subsystem: deps,test label: test - run: ./tools/dep_updaters/update-postject.sh + run: | + NEW_VERSION=$(./tools/dep_updaters/update-eslint.sh | tail -n1) + if [ $? = 0 ]; then + echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV + fi - id: base64 subsystem: deps label: dependencies @@ -112,15 +120,17 @@ jobs: run: | NEW_VERSION=$(gh api repos/libuv/libuv/releases/latest -q '.tag_name|ltrimstr("v")') ./tools/dep_updaters/update-libuv.sh "$NEW_VERSION" + if [ $? = 0 ]; then + echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV + fi - id: simdutf subsystem: deps label: dependencies run: | NEW_VERSION=$(gh api repos/simdutf/simdutf/releases/latest -q '.tag_name|ltrimstr("v")') - CURRENT_VERSION=$(grep "#define SIMDUTF_VERSION" ./deps/simdutf/simdutf.h | sed -n "s/^.*VERSION \(.*\)/\1/p") - if [ "$NEW_VERSION" != "$CURRENT_VERSION" ]; then + ./tools/dep_updaters/update-simdutf.sh "$NEW_VERSION" + if [ $? = 0 ]; then echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV - ./tools/dep_updaters/update-simdutf.sh "$NEW_VERSION" fi - id: ada subsystem: deps diff --git a/tools/dep_updaters/update-eslint.sh b/tools/dep_updaters/update-eslint.sh index 291ceee86d7c6b..533faed4b2a4a0 100755 --- a/tools/dep_updaters/update-eslint.sh +++ b/tools/dep_updaters/update-eslint.sh @@ -21,8 +21,6 @@ if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then exit 0 fi -[ -f "$GITHUB_ENV" ] && echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV || echo "File GITHUB_ENV doesn't exist!" - cd "$( dirname "$0" )" || exit rm -rf ../node_modules/eslint ( @@ -74,3 +72,6 @@ rm -rf ../node_modules/eslint mv eslint-tmp/node_modules/eslint ../node_modules/eslint rm -rf eslint-tmp/ + +# The last line of the script should always be the NEW_VERSION +echo "$NEW_VERSION" diff --git a/tools/dep_updaters/update-libuv.sh b/tools/dep_updaters/update-libuv.sh index 6bf70e64934893..9c7b57e99b68c5 100755 --- a/tools/dep_updaters/update-libuv.sh +++ b/tools/dep_updaters/update-libuv.sh @@ -26,8 +26,6 @@ if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then exit 0 fi -[ -f "$GITHUB_ENV" ] && echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV || echo "File GITHUB_ENV doesn't exist!" - echo "Making temporary workspace..." WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp') diff --git a/tools/dep_updaters/update-postject.sh b/tools/dep_updaters/update-postject.sh index fe9c6ffed2b5f1..e4aebaa1686cfe 100755 --- a/tools/dep_updaters/update-postject.sh +++ b/tools/dep_updaters/update-postject.sh @@ -20,8 +20,6 @@ if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then exit 0 fi -[ -f "$GITHUB_ENV" ] && echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV || echo "File GITHUB_ENV doesn't exist!" - cd "$( dirname "$0" )/../.." || exit rm -rf test/fixtures/postject-copy mkdir test/fixtures/postject-copy @@ -37,3 +35,6 @@ rm -rf deps/postject mkdir deps/postject cp test/fixtures/postject-copy/node_modules/postject/LICENSE deps/postject cp test/fixtures/postject-copy/node_modules/postject/dist/postject-api.h deps/postject + +# The last line of the script should always be the NEW_VERSION +echo "$NEW_VERSION" diff --git a/tools/dep_updaters/update-simdutf.sh b/tools/dep_updaters/update-simdutf.sh index 6d0afa5f77259c..f4c40ef127728d 100755 --- a/tools/dep_updaters/update-simdutf.sh +++ b/tools/dep_updaters/update-simdutf.sh @@ -18,8 +18,6 @@ if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then exit 0 fi -[ -f "$GITHUB_ENV" ] && echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV || echo "File GITHUB_ENV doesn't exist!" - echo "Making temporary workspace..." WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp') From 129b536e615397a5fe1169fb3d02ce21973fe079 Mon Sep 17 00:00:00 2001 From: Tony Gorez Date: Thu, 9 Feb 2023 10:31:55 +0100 Subject: [PATCH 12/19] fix: use proper script fro postject --- .github/workflows/tools.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 3e193fc9ea6846..7d525d37af6b27 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -79,7 +79,7 @@ jobs: subsystem: deps,test label: test run: | - NEW_VERSION=$(./tools/dep_updaters/update-eslint.sh | tail -n1) + NEW_VERSION=$(./tools/dep_updaters/update-postject.sh | tail -n1) if [ $? = 0 ]; then echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV fi From 8b250dc5980c640fb818de696859fe6e13ddbfa1 Mon Sep 17 00:00:00 2001 From: Tony Gorez Date: Sat, 18 Feb 2023 15:19:22 +0100 Subject: [PATCH 13/19] fix: refactor --- .github/workflows/tools.yml | 18 ++++++++++-------- tools/dep_updaters/update-eslint.sh | 5 +++-- tools/dep_updaters/update-postject.sh | 5 +++-- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 7d525d37af6b27..04e0b48d4daa82 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -21,10 +21,11 @@ jobs: subsystem: tools label: tools run: | - NEW_VERSION=$(./tools/dep_updaters/update-eslint.sh | tail -n1) - if [ $? = 0 ]; then - echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV - fi + ./tools/dep_updaters/update-eslint.sh > temp-output + cat temp-output + MAYBE_VERSION=$(tail -n1 temp-output) + if grep -q "NEW_VERSION" <<< "$MAYBE_VERSION"; then $MAYBE_VERSION >> $GITHUB_ENV; fi + rm temp-output - id: corepack subsystem: deps label: dependencies @@ -79,10 +80,11 @@ jobs: subsystem: deps,test label: test run: | - NEW_VERSION=$(./tools/dep_updaters/update-postject.sh | tail -n1) - if [ $? = 0 ]; then - echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV - fi + ./tools/dep_updaters/update-postject.sh > temp-output + cat temp-output + MAYBE_VERSION=$(tail -n1 temp-output) + if grep -q "NEW_VERSION" <<< "$MAYBE_VERSION"; then $MAYBE_VERSION >> $GITHUB_ENV; fi + rm temp-output - id: base64 subsystem: deps label: dependencies diff --git a/tools/dep_updaters/update-eslint.sh b/tools/dep_updaters/update-eslint.sh index 533faed4b2a4a0..b3025bb8ff9e7e 100755 --- a/tools/dep_updaters/update-eslint.sh +++ b/tools/dep_updaters/update-eslint.sh @@ -73,5 +73,6 @@ rm -rf ../node_modules/eslint mv eslint-tmp/node_modules/eslint ../node_modules/eslint rm -rf eslint-tmp/ -# The last line of the script should always be the NEW_VERSION -echo "$NEW_VERSION" +# The last line of the script should always print the new version, +# as we need to add it to $GITHUB_ENV variable. +echo "NEW_VERSION=$NEW_VERSION" diff --git a/tools/dep_updaters/update-postject.sh b/tools/dep_updaters/update-postject.sh index e4aebaa1686cfe..f7a63ce1816cf9 100755 --- a/tools/dep_updaters/update-postject.sh +++ b/tools/dep_updaters/update-postject.sh @@ -36,5 +36,6 @@ mkdir deps/postject cp test/fixtures/postject-copy/node_modules/postject/LICENSE deps/postject cp test/fixtures/postject-copy/node_modules/postject/dist/postject-api.h deps/postject -# The last line of the script should always be the NEW_VERSION -echo "$NEW_VERSION" +# The last line of the script should always print the new version, +# as we need to add it to $GITHUB_ENV variable. +echo "NEW_VERSION=$NEW_VERSION" From 550666b49f31fd3fbbab7f85af2ab5c0efa218ec Mon Sep 17 00:00:00 2001 From: Tony Gorez Date: Mon, 20 Feb 2023 17:09:32 +0100 Subject: [PATCH 14/19] fix: simplify pre-scripts --- .github/workflows/tools.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 04e0b48d4daa82..3b45d2a6780b5b 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -23,8 +23,7 @@ jobs: run: | ./tools/dep_updaters/update-eslint.sh > temp-output cat temp-output - MAYBE_VERSION=$(tail -n1 temp-output) - if grep -q "NEW_VERSION" <<< "$MAYBE_VERSION"; then $MAYBE_VERSION >> $GITHUB_ENV; fi + tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" rm temp-output - id: corepack subsystem: deps @@ -82,8 +81,7 @@ jobs: run: | ./tools/dep_updaters/update-postject.sh > temp-output cat temp-output - MAYBE_VERSION=$(tail -n1 temp-output) - if grep -q "NEW_VERSION" <<< "$MAYBE_VERSION"; then $MAYBE_VERSION >> $GITHUB_ENV; fi + tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" rm temp-output - id: base64 subsystem: deps From 69370b0887e7e51ec6723ffcbae32dd51c68d925 Mon Sep 17 00:00:00 2001 From: Tony Gorez Date: Thu, 23 Feb 2023 11:30:18 +0100 Subject: [PATCH 15/19] fix: check console output for libuv and simtduf scripts --- .github/workflows/tools.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 3b45d2a6780b5b..c6ec0e807086fe 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -119,19 +119,23 @@ jobs: label: dependencies run: | NEW_VERSION=$(gh api repos/libuv/libuv/releases/latest -q '.tag_name|ltrimstr("v")') - ./tools/dep_updaters/update-libuv.sh "$NEW_VERSION" - if [ $? = 0 ]; then + ./tools/dep_updaters/update-libuv.sh "$NEW_VERSION" > temp-output + cat temp-output + if cat temp-output | grep "All done!"; then echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV fi + rm temp-output - id: simdutf subsystem: deps label: dependencies run: | NEW_VERSION=$(gh api repos/simdutf/simdutf/releases/latest -q '.tag_name|ltrimstr("v")') - ./tools/dep_updaters/update-simdutf.sh "$NEW_VERSION" - if [ $? = 0 ]; then + ./tools/dep_updaters/update-simdutf.sh "$NEW_VERSION" > temp-output + cat temp-output + if cat temp-output | grep "All done!"; then echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV fi + rm temp-output - id: ada subsystem: deps label: dependencies From f3ef6b18077fc470fba527ff14221499ae2649c5 Mon Sep 17 00:00:00 2001 From: Tony Gorez Date: Thu, 23 Feb 2023 12:15:58 +0100 Subject: [PATCH 16/19] fix: simplify script --- .github/workflows/tools.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index c6ec0e807086fe..0facaeac43cd89 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -121,7 +121,7 @@ jobs: NEW_VERSION=$(gh api repos/libuv/libuv/releases/latest -q '.tag_name|ltrimstr("v")') ./tools/dep_updaters/update-libuv.sh "$NEW_VERSION" > temp-output cat temp-output - if cat temp-output | grep "All done!"; then + if grep -q "All done!" temp-output; then echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV fi rm temp-output @@ -132,7 +132,7 @@ jobs: NEW_VERSION=$(gh api repos/simdutf/simdutf/releases/latest -q '.tag_name|ltrimstr("v")') ./tools/dep_updaters/update-simdutf.sh "$NEW_VERSION" > temp-output cat temp-output - if cat temp-output | grep "All done!"; then + if grep -q "All done!" temp-output; then echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV fi rm temp-output From 658ec1ce6ddcfc45eacc65f59902641c205d86be Mon Sep 17 00:00:00 2001 From: Tony Gorez Date: Fri, 24 Feb 2023 12:21:00 +0100 Subject: [PATCH 17/19] tools: abstract new version fetch into scripts --- .github/workflows/tools.yml | 14 ++++---------- tools/dep_updaters/update-libuv.sh | 20 +++++++++++++------- tools/dep_updaters/update-simdutf.sh | 20 +++++++++++++------- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 0facaeac43cd89..34013efc44a848 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -118,23 +118,17 @@ jobs: subsystem: deps label: dependencies run: | - NEW_VERSION=$(gh api repos/libuv/libuv/releases/latest -q '.tag_name|ltrimstr("v")') - ./tools/dep_updaters/update-libuv.sh "$NEW_VERSION" > temp-output + ./tools/dep_updaters/update-libuv.sh > temp-output cat temp-output - if grep -q "All done!" temp-output; then - echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV - fi + tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" rm temp-output - id: simdutf subsystem: deps label: dependencies run: | - NEW_VERSION=$(gh api repos/simdutf/simdutf/releases/latest -q '.tag_name|ltrimstr("v")') - ./tools/dep_updaters/update-simdutf.sh "$NEW_VERSION" > temp-output + ./tools/dep_updaters/update-simdutf.sh > temp-output cat temp-output - if grep -q "All done!" temp-output; then - echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV - fi + tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" rm temp-output - id: ada subsystem: deps diff --git a/tools/dep_updaters/update-libuv.sh b/tools/dep_updaters/update-libuv.sh index 9c7b57e99b68c5..a8a51639330b25 100755 --- a/tools/dep_updaters/update-libuv.sh +++ b/tools/dep_updaters/update-libuv.sh @@ -2,16 +2,18 @@ set -e # Shell script to update libuv in the source tree to a specific version -if [ "$#" -le 0 ]; then - echo "Error: please provide an libuv version to update to" - echo " e.g. $0 1.44.2" - exit 1 -fi - BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd) DEPS_DIR="$BASE_DIR/deps" +[ -z "$NODE" ] && NODE="$ROOT/out/Release/node" +[ -x "$NODE" ] || NODE=$(command -v node) + +NEW_VERSION="$("$NODE" --input-type=module <<'EOF' +const res = await fetch('https://api.github.com/repos/libuv/libuv/releases/latest'); +if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); +const { tag_name } = await res.json(); +console.log(tag_name.replace('v', '')); +EOF)" -NEW_VERSION=$1 VERSION_H="$DEPS_DIR/uv/include/uv/version.h" CURRENT_MAJOR_VERSION=$(grep "#define UV_VERSION_MAJOR" "$VERSION_H" | sed -n "s/^.*MAJOR \(.*\)/\1/p") CURRENT_MINOR_VERSION=$(grep "#define UV_VERSION_MINOR" "$VERSION_H" | sed -n "s/^.*MINOR \(.*\)/\1/p") @@ -56,3 +58,7 @@ echo "" echo "$ git add -A deps/uv" echo "$ git commit -m \"deps: update libuv to $NEW_VERSION\"" echo "" + +# The last line of the script should always print the new version, +# as we need to add it to $GITHUB_ENV variable. +echo "NEW_VERSION=$NEW_VERSION" diff --git a/tools/dep_updaters/update-simdutf.sh b/tools/dep_updaters/update-simdutf.sh index f4c40ef127728d..f76dde2ce21d5e 100755 --- a/tools/dep_updaters/update-simdutf.sh +++ b/tools/dep_updaters/update-simdutf.sh @@ -2,15 +2,17 @@ set -e # Shell script to update simdutf in the source tree to a specific version -if [ "$#" -le 0 ]; then - echo "Error: please provide an simdutf version to update to" - echo " e.g. $0 2.0.3" - exit 1 -fi - BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd) DEPS_DIR="$BASE_DIR/deps" -NEW_VERSION=$1 +[ -z "$NODE" ] && NODE="$ROOT/out/Release/node" +[ -x "$NODE" ] || NODE=$(command -v node) + +NEW_VERSION="$("$NODE" --input-type=module <<'EOF' +const res = await fetch('https://api.github.com/repos/simdutf/simdutf/releases/latest'); +if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); +const { tag_name } = await res.json(); +console.log(tag_name.replace('v', '')); +EOF)" CURRENT_VERSION=$(grep "#define SIMDUTF_VERSION" "$DEPS_DIR/simdutf/simdutf.h" | sed -n "s/^.*VERSION \"\(.*\)\"/\1/p") if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then @@ -56,3 +58,7 @@ echo "" echo "$ git add -A deps/simdutf" echo "$ git commit -m \"deps: update simdutf to $NEW_VERSION\"" echo "" + +# The last line of the script should always print the new version, +# as we need to add it to $GITHUB_ENV variable. +echo "NEW_VERSION=$NEW_VERSION" From e1c41d25c775c3168126850a3ded455b29853dcb Mon Sep 17 00:00:00 2001 From: Tony Gorez Date: Fri, 24 Feb 2023 14:12:32 +0100 Subject: [PATCH 18/19] fix: scripts syntax --- tools/dep_updaters/update-libuv.sh | 5 +++-- tools/dep_updaters/update-simdutf.sh | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/dep_updaters/update-libuv.sh b/tools/dep_updaters/update-libuv.sh index a8a51639330b25..a7ab4de930fc41 100755 --- a/tools/dep_updaters/update-libuv.sh +++ b/tools/dep_updaters/update-libuv.sh @@ -4,7 +4,7 @@ set -e BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd) DEPS_DIR="$BASE_DIR/deps" -[ -z "$NODE" ] && NODE="$ROOT/out/Release/node" +[ -z "$NODE" ] && NODE="$BASE_DIR/out/Release/node" [ -x "$NODE" ] || NODE=$(command -v node) NEW_VERSION="$("$NODE" --input-type=module <<'EOF' @@ -12,7 +12,8 @@ const res = await fetch('https://api.github.com/repos/libuv/libuv/releases/lates if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); const { tag_name } = await res.json(); console.log(tag_name.replace('v', '')); -EOF)" +EOF +)" VERSION_H="$DEPS_DIR/uv/include/uv/version.h" CURRENT_MAJOR_VERSION=$(grep "#define UV_VERSION_MAJOR" "$VERSION_H" | sed -n "s/^.*MAJOR \(.*\)/\1/p") diff --git a/tools/dep_updaters/update-simdutf.sh b/tools/dep_updaters/update-simdutf.sh index f76dde2ce21d5e..d9e97cb21e4e60 100755 --- a/tools/dep_updaters/update-simdutf.sh +++ b/tools/dep_updaters/update-simdutf.sh @@ -4,7 +4,7 @@ set -e BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd) DEPS_DIR="$BASE_DIR/deps" -[ -z "$NODE" ] && NODE="$ROOT/out/Release/node" +[ -z "$NODE" ] && NODE="$BASE_DIR/out/Release/node" [ -x "$NODE" ] || NODE=$(command -v node) NEW_VERSION="$("$NODE" --input-type=module <<'EOF' @@ -12,7 +12,8 @@ const res = await fetch('https://api.github.com/repos/simdutf/simdutf/releases/l if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); const { tag_name } = await res.json(); console.log(tag_name.replace('v', '')); -EOF)" +EOF +)" CURRENT_VERSION=$(grep "#define SIMDUTF_VERSION" "$DEPS_DIR/simdutf/simdutf.h" | sed -n "s/^.*VERSION \"\(.*\)\"/\1/p") if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then From 489e7d3cf4e19e6422ea8e0236de714fa58e6971 Mon Sep 17 00:00:00 2001 From: Tony Gorez Date: Thu, 2 Mar 2023 08:57:29 +0100 Subject: [PATCH 19/19] fix: add fallback to avoir job failure --- .github/workflows/tools.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 34013efc44a848..c5ae22f7fec017 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -23,7 +23,7 @@ jobs: run: | ./tools/dep_updaters/update-eslint.sh > temp-output cat temp-output - tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" + tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true rm temp-output - id: corepack subsystem: deps @@ -81,7 +81,7 @@ jobs: run: | ./tools/dep_updaters/update-postject.sh > temp-output cat temp-output - tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" + tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true rm temp-output - id: base64 subsystem: deps @@ -120,7 +120,7 @@ jobs: run: | ./tools/dep_updaters/update-libuv.sh > temp-output cat temp-output - tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" + tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true rm temp-output - id: simdutf subsystem: deps @@ -128,7 +128,7 @@ jobs: run: | ./tools/dep_updaters/update-simdutf.sh > temp-output cat temp-output - tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" + tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true rm temp-output - id: ada subsystem: deps