Skip to content

Commit

Permalink
fix: get exact version of stable (#497)
Browse files Browse the repository at this point in the history
* fix: get exact version of `stable`

* style: remove old code resolving `stable` version

* style: use `https`

Co-authored-by: jiro <[email protected]>

* fix: hande versions like `1.6.x` or `2.x`

* style: make diff smaller

---------

Co-authored-by: jiro <[email protected]>
  • Loading branch information
vil02 and jiro4989 authored Jul 8, 2024
1 parent 9bf991d commit 1b7e243
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions install_nim.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,15 @@ if [[ "$nim_version" = "devel" ]]; then
exit
fi

# fetch latest tag if 'nim_version' was 'stable'
# get exact version of stable
if [[ "$nim_version" = "stable" ]]; then
# NOTE: jq is pre-installed on github actions runner
nim_version="$(fetch_tags | latest_version)"
elif [[ "$nim_version" =~ ^[0-9]+\.[0-9]+\.x$ ]] || [[ "$nim_version" =~ ^[0-9]+\.x$ ]]; then
nim_version=$(curl -sSL https://nim-lang.org/channels/stable)
fi

if [[ "$nim_version" =~ ^[0-9]+\.[0-9]+\.x$ ]] || [[ "$nim_version" =~ ^[0-9]+\.x$ ]]; then
nim_version="$(fetch_tags | grep -E "$(tag_regexp "$nim_version")" | latest_version)"
fi

info "install nim $nim_version"

# download nim compiler
Expand Down

0 comments on commit 1b7e243

Please sign in to comment.