diff --git a/build.sh b/build.sh index bc6ed5e..405cffd 100755 --- a/build.sh +++ b/build.sh @@ -16,6 +16,12 @@ ARCHIVE_NAME="X11Proxy-${VERSION}-linux-x86_64.tar.gz" REPO="ezterry/X11Proxy" GITEA_URL="https://git-hojo.devnull.name" +if [[ -z "$VERSION" ]]; then + echo "โŒ Failed to extract version from main.go" + echo "please fix the version constant in main.go" + exit 1 +fi + echo "$BIN_NAME build script (version: $VERSION)" # ๐Ÿงน Clean build artifacts @@ -44,6 +50,12 @@ build_dist() { # ๐Ÿš€ Publish release to Gitea publish_release() { + #verify we will not run into an issue from a missing jq command + command -v jq >/dev/null || { + echo "โŒ 'jq' is required but not installed. Please install it to continue." + exit 1 + } + build_dist echo "๐Ÿ” Enter Gitea token (will not be saved):" @@ -59,7 +71,7 @@ publish_release() { git push origin $TAG echo "๐Ÿ“ค Creating release on Gitea..." - curl -s -X POST "${GITEA_URL}/api/v1/repos/${REPO}/releases" \ + RELEASE_JSON=$(curl -s -X POST "${GITEA_URL}/api/v1/repos/${REPO}/releases" \ -H "Authorization: token ${GITEA_TOKEN}" \ -H "Content-Type: application/json" \ -d @- <