Skip to content

Commit

Permalink
ci: use jq to get gh cli (#2168)
Browse files Browse the repository at this point in the history
Signed-off-by: Thibaud CANALE <[email protected]>
  • Loading branch information
thican authored Dec 21, 2024
1 parent 6aae07d commit d0d0da1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions install_gh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ set -ex

GH_ARCH="amd64"

VERSION=$( curl --retry 12 --retry-delay 30 "https://api.github.com/repos/cli/cli/releases/latest" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/' | cut -c2- )
TAG=$( curl --retry 12 --retry-delay 30 "https://api.github.com/repos/cli/cli/releases/latest" | jq --raw-output '.tag_name' )
VERSION=${TAG#v}

curl --retry 12 --retry-delay 120 -sSL "https://github.com/cli/cli/releases/download/v${VERSION}/gh_${VERSION}_linux_${GH_ARCH}.tar.gz" -o "gh_${VERSION}_linux_${GH_ARCH}.tar.gz"
curl --retry 12 --retry-delay 120 -sSL "https://github.com/cli/cli/releases/download/${TAG}/gh_${VERSION}_linux_${GH_ARCH}.tar.gz" -o "gh_${VERSION}_linux_${GH_ARCH}.tar.gz"

tar xf "gh_${VERSION}_linux_${GH_ARCH}.tar.gz"

Expand Down

0 comments on commit d0d0da1

Please sign in to comment.