Skip to content

Commit

Permalink
Use path instead of longVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
r0qs committed Oct 31, 2022
1 parent b18711d commit 6e17949
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/is-binary-up-to-date.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ function check_release_version() {

# Retrieve the latest released version
latest_version_short=$(jq --raw-output ".latestRelease" "$LIST_FILE")
latest_version_long=$(jq --raw-output ".releases | .[\"${latest_version_short}\"]" "$LIST_FILE" | sed --regexp-extended --quiet 's/^soljson-v(.*).js$/\1/p')
latest_release_path=$(jq --raw-output ".releases | .[\"${latest_version_short}\"]" "$LIST_FILE")

# Check if current version is the latest release
if [[ $current_version != "$latest_version_long" ]]; then
if [[ "soljson-v${current_version}.js" != "$latest_release_path" ]]; then
fail "Version is not the latest release:\n [current]: ${current_version}\n [latest]: ${latest_version_short}"
fi

current_sha=$(shasum --binary --algorithm 256 ./soljson.js | awk '{ print $1 }')
release_sha=$(jq --raw-output ".builds[] | select(.longVersion == \"${latest_version_long}\") | .sha256" "$LIST_FILE" | sed 's/^0x//')
release_sha=$(jq --raw-output ".builds[] | select(.path == \"${latest_release_path}\") | .sha256" "$LIST_FILE" | sed 's/^0x//')

# Check if sha matches
if [[ $current_sha != "$release_sha" ]]; then
Expand Down

0 comments on commit 6e17949

Please sign in to comment.