Skip to content

Commit 407e9ef

Browse files
committed
feat: Print out the auto-downloading version
1 parent 764bb89 commit 407e9ef

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

entrypoint.sh

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,25 @@ set -euo pipefail
44

55
VERSION=$1
66

7-
# Empty string means get latest, leave it empty
8-
if [[ -z "${VERSION}" ]]; then
9-
TAG=""
10-
# The tag is the version prefixed with a 'v' (if not already provided)
11-
elif [[ ! ${VERSION} =~ ^v.* ]]; then
12-
TAG="v${VERSION}"
13-
else
14-
TAG="${VERSION}"
15-
fi
7+
# If a version was set, do some massaging
8+
if [[ -n "${VERSION}" ]]; then
9+
# The tag is the version prefixed with a 'v' (if not already provided)
10+
if [[ ! ${VERSION} =~ ^v.* ]]; then
11+
TAG="v${VERSION}"
12+
else
13+
TAG="${VERSION}"
14+
fi
1615

17-
# If the version is 0.16.2 or greater, the tag is prefixed with knope/
18-
if [[ ${TAG} == "v0.16.2" || ${TAG} > "v0.16.2" ]]; then
19-
TAG="knope/${TAG}"
16+
# If the version is 0.16.2 or greater, the tag is prefixed with knope/
17+
if [[ ${TAG} == "v0.16.2" || ${TAG} > "v0.16.2" ]]; then
18+
TAG="knope/${TAG}"
19+
fi
20+
else # If the tag is empty, get the latest release
21+
TAG=$(gh release list --json tagName --jq '.[].tagName' --repo "knope-dev/knope" | grep knope | head -n 1)
2022
fi
2123

2224
# Use the GitHub CLI to download
23-
25+
echo "Downloading ${TAG}"
2426
gh release download "${TAG}" --repo "knope-dev/knope" --pattern "*linux*"
2527
TAR_FILE=$(ls knope-*.tgz)
2628
tar -xvf "$TAR_FILE"

0 commit comments

Comments
 (0)