File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change 1212GH_OWNER=" graphql-hive"
1313GH_REPO=" router"
1414BINARY_NAME=" hive_router"
15+ CARGO_PKG_NAME=" hive-router"
1516
1617info () {
1718 echo " \033[34m[INFO]\033[0m $1 "
@@ -76,23 +77,23 @@ detect_arch() {
7677
7778get_version () {
7879 if [ -n " $1 " ]; then
79- VERSION=" hive-router- $1 "
80+ VERSION=" $1 "
8081 info " Installing specified version: $VERSION "
8182 else
82- info " No version specified. Fetching the latest release from GitHub ..."
83- LATEST_RELEASE_URL =" https://api.github.com/repos/ ${GH_OWNER} / ${GH_REPO} /releases/latest "
84- VERSION=$( curl -sL " $LATEST_RELEASE_URL " | grep ' "tag_name": ' | sed -E ' s/.*" ([^"]+)".* /\1/' )
83+ info " No version specified. Fetching the latest version from crates.io ..."
84+ CRATES_API_URL =" https://crates.io/api/v1/crates/ ${CARGO_PKG_NAME} "
85+ VERSION=$( curl -sL " $CRATES_API_URL " | grep -o ' "max_version":"[^"]*" ' | head -1 | sed ' s/"max_version":"\ ([^"]*\)" /\1/' )
8586
8687 if [ -z " $VERSION " ]; then
87- error " Could not determine the latest version. Please check the repository details ."
88+ error " Could not determine the latest version from crates.io. Please check the crate name ."
8889 fi
89- info " Latest version found: $VERSION "
90+ info " Latest version found on crates.io : $VERSION "
9091 fi
9192}
9293
9394download_and_install () {
9495 ASSET_NAME=" ${BINARY_NAME} _${OS} _${ARCH} "
95- DOWNLOAD_URL=" https://github.com/${GH_OWNER} /${GH_REPO} /releases/download/${VERSION} /${ASSET_NAME} "
96+ DOWNLOAD_URL=" https://github.com/${GH_OWNER} /${GH_REPO} /releases/download/router%2Fv ${VERSION} /${ASSET_NAME} "
9697
9798 info " Downloading binary from: ${DOWNLOAD_URL} "
9899
You can’t perform that action at this time.
0 commit comments