Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions aztec-up/bin/0.0.1/aztec-install
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,20 @@ VERSION=${VERSION:-0.0.1}
# Install URI (root, not version-specific)
INSTALL_URI="${INSTALL_URI:-https://install.aztec-labs.com}"

# Check if version string is valid semver
function is_semver {
local version="$1"
local semver_regex='^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.-]+)?(\+[a-zA-Z0-9.]+)?$'
[[ "$version" =~ $semver_regex ]]
}

# Resolve alias (like "nightly") to actual version number.
function resolve_version {
local version="$1"
local semver_regex='^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.-]+)?(\+[a-zA-Z0-9.]+)?$'
if [[ "$version" =~ $semver_regex ]]; then
echo "$version"
# Strip leading v from semver-like inputs (v0.85.0 -> 0.85.0), but not aliases (v4-nightly)
local stripped="${version#v}"
if is_semver "$stripped"; then
echo "$stripped"
else
local resolved
if ! resolved=$(curl -fsSL "$INSTALL_URI/aliases/$version" 2>/dev/null); then
Expand Down
6 changes: 4 additions & 2 deletions aztec-up/bin/0.0.1/aztec-up
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@ function is_semver {
# Resolve alias (like "nightly") to actual version number
function resolve_version {
local version="$1"
if is_semver "$version"; then
echo "$version"
# Strip leading v from semver-like inputs (v0.85.0 -> 0.85.0), but not aliases (v4-nightly)
local stripped="${version#v}"
if is_semver "$stripped"; then
echo "$stripped"
else
# Fetch alias file to get actual version
local resolved
Expand Down
Loading