From 0d75839b85e4d6f935faff445c2e26d845cba9b4 Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Wed, 18 Sep 2024 12:07:00 +1000 Subject: [PATCH] feat: download release tarball from named release Avoid the need for using the commit hash to find the release. Fixes: https://github.com/filecoin-project/filecoin-ffi/issues/491 --- install-filcrypto | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/install-filcrypto b/install-filcrypto index d75021b0..9d6984d5 100755 --- a/install-filcrypto +++ b/install-filcrypto @@ -81,8 +81,16 @@ download_release_tarball() { local __rust_sources_path=$2 local __repo_name=$3 local __release_flags=$4 - local __release_sha1=$(git rev-parse HEAD) - local __release_tag="${__release_sha1:0:16}" + local __release_tags=$(git tag --points-at "$(git rev-parse HEAD)") + local __release_tag=$(echo "${__release_tags}" | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+(-\w+)?$' | head -n 1) + + # If we're building from a commit that doesn't have a tag, we need to + # compile from source. + if [ -z "${__release_tag}" ]; then + (>&2 echo "[download_release_tarball] failed to determine release tag") + return 1 + fi + local __release_tag_url="https://api.github.com/repos/filecoin-project/${__repo_name}/releases/tags/${__release_tag}" # Download the non-optimized standard release.