Skip to content

Commit

Permalink
improvement: allow to specify release to install
Browse files Browse the repository at this point in the history
This will allow users to do things like:

```bash
curl -sL https://get.garden.io/install.sh edge | bash
```

or 

```bash
curl -sL https://get.garden.io/install.sh v0.11.0-alpha.4 | bash
```

Leaving out the parameter will install the latest released version.
  • Loading branch information
khaled authored and edvald committed Jan 14, 2020
1 parent 79f3529 commit 699fd37
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions support/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,20 @@ echo "  [48;2;92
echo "❊ Installing the Garden CLI ❊"
echo ""

echo "→ Finding the latest version..."

# Find version to run through GitHub release API
function jsonValue() {
# see https://gist.github.com/cjus/1047794
KEY=$1
num=$2
awk -F"[,:}]" '{for(i=1;i<=NF;i++){if($i~/'$KEY'\042/){print $(i+1)}}}' | tr -d '"' | sed -n ${num}p
}

GARDEN_VERSION=$(curl -sL https://github.com/garden-io/garden/releases/latest -H "Accept: application/json" | jsonValue tag_name 1)
if [[ -n $1 ]]
then
GARDEN_VERSION=$1
else
echo "→ Finding the latest version..."
# Find version to run through GitHub release API
function jsonValue() {
# see https://gist.github.com/cjus/1047794
KEY=$1
num=$2
awk -F"[,:}]" '{for(i=1;i<=NF;i++){if($i~/'$KEY'\042/){print $(i+1)}}}' | tr -d '"' | sed -n ${num}p
}
GARDEN_VERSION=$(curl -sL https://github.com/garden-io/garden/releases/latest -H "Accept: application/json" | jsonValue tag_name 1)
fi

if [ "$(uname -s)" = "Darwin" ]; then
OS=macos
Expand Down

0 comments on commit 699fd37

Please sign in to comment.