From 9c9016d36ac2181534f580d0ff93159a4375efcf Mon Sep 17 00:00:00 2001 From: Markus Westerlind Date: Tue, 19 Sep 2023 09:02:27 +0200 Subject: [PATCH] chore: Fix sync_publish.sh script --- scripts/publish.sh | 1 + scripts/sync_publish.sh | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/publish.sh b/scripts/publish.sh index 6a0b86637..7a4fac696 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -ex VERSION=$(echo $1 | sed 's/v//') shift diff --git a/scripts/sync_publish.sh b/scripts/sync_publish.sh index 018ea8e77..e2efb454b 100755 --- a/scripts/sync_publish.sh +++ b/scripts/sync_publish.sh @@ -13,6 +13,8 @@ TMP_DIR=/tmp/test1 DIR="$1" FORCE="$2" +shift +shift NAME=$(grep '^name' "$DIR/Cargo.toml" | head -n 1 | sed 's/name = "\([^"]*\)"/\1/') cd "$DIR" @@ -22,8 +24,7 @@ VERSION=$(cargo metadata --format-version 1 2>/dev/null | jq -r '.packages[] | s rm -rf "$TMP_DIR" cargo new "$TMP_DIR" > /dev/null 2>&1 cd "$TMP_DIR" -cargo add "$NAME" --vers "=$VERSION" > /dev/null 2>&1 -if cargo generate-lockfile > /dev/null 2>&1; then +if cargo add "$NAME@$VERSION" > /dev/null 2>&1; then echo "$NAME=$VERSION already exists, skipping." exit 0 fi @@ -35,10 +36,10 @@ if [ "$FORCE" != "-f" ]; then fi cd "$DIR" -cargo publish +cargo publish $@ cd "$TMP_DIR" -while ! cargo generate-lockfile > /dev/null 2>&1; do +while ! cargo add "$NAME@$VERSION" > /dev/null 2>&1; do echo "Waiting for crate to be published..." sleep 1 done