Update update-librusty script to fetch Cargo.lock from repository

+10 -3
+10 -3
pkgs/by-name/wi/windmill/update-librusty.sh
··· 1 #!/usr/bin/env nix-shell 2 - #!nix-shell -i bash -p gnugrep gnused nix 3 # shellcheck shell=bash 4 5 set -eu -o pipefail 6 7 - # ASSUMES; The Cargo.lock file inside this directory holds the correct librusty version 8 9 PACKAGE_DIR=$(dirname "$(readlink --canonicalize-existing "${BASH_SOURCE[0]}")") 10 OUTPUT_FILE="$PACKAGE_DIR/librusty_v8.nix" 11 - NEW_VERSION="$(grep --after-context 5 'name = "v8"' "$PACKAGE_DIR/Cargo.lock" | grep 'version =' | sed -E 's/version = "//;s/"//')" 12 13 CURRENT_VERSION="" 14 if [ -f "$OUTPUT_FILE" ]; then ··· 36 EOF 37 38 mv "$TEMP_FILE" "$OUTPUT_FILE"
··· 1 #!/usr/bin/env nix-shell 2 + #!nix-shell -i bash -p gnugrep gnused nix jq 3 # shellcheck shell=bash 4 5 set -eu -o pipefail 6 7 + echo "librusty_v8: UPDATING" 8 + 9 + # ASSUMES; The Cargo.lock file is located at <REPO>/backend/Cargo.toml 10 + 11 + WINDMILL_LATEST_VERSION=$(curl ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} --silent --fail --location "https://api.github.com/repos/windmill-labs/windmill/releases/latest" | jq --raw-output .tag_name) 12 + CARGO_LOCK=$(curl ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} --silent --fail --location "https://github.com/windmill-labs/windmill/raw/$WINDMILL_LATEST_VERSION/backend/Cargo.lock") 13 14 PACKAGE_DIR=$(dirname "$(readlink --canonicalize-existing "${BASH_SOURCE[0]}")") 15 OUTPUT_FILE="$PACKAGE_DIR/librusty_v8.nix" 16 + NEW_VERSION=$(echo "$CARGO_LOCK" | grep --after-context 5 'name = "v8"' | grep 'version =' | sed -E 's/version = "//;s/"//') 17 18 CURRENT_VERSION="" 19 if [ -f "$OUTPUT_FILE" ]; then ··· 41 EOF 42 43 mv "$TEMP_FILE" "$OUTPUT_FILE" 44 + 45 + echo "librusty_v8: UPDATE DONE"