From 01a08ed8be965d981d7caa408710c8619830e40c Mon Sep 17 00:00:00 2001 From: Santiago Palladino Date: Wed, 4 Oct 2023 12:23:13 -0300 Subject: [PATCH] fix: Deploy npm fixes --- build-system/scripts/extract_tag_version | 2 +- yarn-project/deploy_npm.sh | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/build-system/scripts/extract_tag_version b/build-system/scripts/extract_tag_version index 55e79a1865e..43151389717 100755 --- a/build-system/scripts/extract_tag_version +++ b/build-system/scripts/extract_tag_version @@ -10,7 +10,7 @@ REPOSITORY="$1" ERROR_ON_FAIL="${2:-"false"}" # Check if there is a commit tag -if [[ -z "$COMMIT_TAG" ]]; then +if [[ -z "${COMMIT_TAG:-}" ]]; then if [[ "$ERROR_ON_FAIL" == "true" ]]; then echo "No commit tag found. Exiting" >&2 exit 1 diff --git a/yarn-project/deploy_npm.sh b/yarn-project/deploy_npm.sh index a290ead1edd..0c02f9e21cd 100755 --- a/yarn-project/deploy_npm.sh +++ b/yarn-project/deploy_npm.sh @@ -9,7 +9,10 @@ echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc function deploy_package() { REPOSITORY=$1 - VERSION=$(extract_tag_version $REPOSITORY false) + cd $REPOSITORY + + VERSION=$(extract_tag_version $REPOSITORY true) + echo "Deploying $REPOSITORY $VERSION" # If the commit tag itself has a dist-tag (e.g. v2.1.0-testnet.123), extract the dist-tag. TAG=$(echo "$VERSION" | grep -oP ".*-\K(.*)(?=\.\d+)" || true) @@ -18,8 +21,8 @@ function deploy_package() { TAG_ARG="--tag $TAG" fi - readonly PUBLISHED_VERSION=$(npm show . version ${TAG_ARG:-} 2> /dev/null) - readonly HIGHER_VERSION=$(npx semver ${VERSION} ${PUBLISHED_VERSION} | tail -1) + PUBLISHED_VERSION=$(npm show . version ${TAG_ARG:-} 2> /dev/null) + HIGHER_VERSION=$(npx semver ${VERSION} ${PUBLISHED_VERSION} | tail -1) # If there is already a published package equal to given version, assume this is a re-run of a deploy, and early out. if [ "$VERSION" == "$PUBLISHED_VERSION" ]; then @@ -50,7 +53,11 @@ function deploy_package() { else npm publish --dry-run $TAG_ARG --access public fi + + # Back to root + cd .. } + deploy_package foundation deploy_package circuits.js deploy_package types