Skip to content

Commit

Permalink
feat(dojoup): remove jq dependency (#847)
Browse files Browse the repository at this point in the history
* feat(dojoup): remove jq dependency

* make it more robust
  • Loading branch information
lambda-0x authored Aug 29, 2023
1 parent d5136a4 commit 857cbc3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions dojoup/dojoup
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,16 @@ main() {
if [[ "$DOJOUP_REPO" == "dojoengine/dojo" && -z "$DOJOUP_BRANCH" && -z "$DOJOUP_COMMIT" ]]; then
DOJOUP_VERSION=${DOJOUP_VERSION-stable}
DOJOUP_TAG=$DOJOUP_VERSION
need_cmd jq

# Normalize versions (handle channels, versions without v prefix
if [[ "$DOJOUP_VERSION" == "stable" ]]; then
# Fetch the list of releases from the GitHub API and get the first non-prerelease
# Fetch the list of releases from the GitHub API and filter out `prerelease`` releases and `alpha`` releases
DOJOUP_TAG=$(curl -s "https://api.github.com/repos/${DOJOUP_REPO}/releases" \
| jq -r '.[] | select(.prerelease==false) | .tag_name' \
| grep -v '-' \
| grep -oE '"tag_name": "[^"]*"|"prerelease": (true|false)' \
| grep -B1 '"prerelease": false' \
| grep '"tag_name":' \
| grep -oP '"v[0-9]*\.[0-9]*\.[0-9]*"' \
| tr -d '"' \
| head -n 1)
DOJOUP_VERSION=$DOJOUP_TAG
elif [[ "$DOJOUP_VERSION" == nightly* ]]; then
Expand Down

0 comments on commit 857cbc3

Please sign in to comment.