Skip to content

Commit

Permalink
Split variables more so we can check for errors
Browse files Browse the repository at this point in the history
  • Loading branch information
arctixdev committed Oct 30, 2024
1 parent 95009a5 commit fc2a2c6
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions check_release.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
#!/usr/bin/env bash
RELEASES=('AARCH64_SHA256' 'X64_SHA256')

TAG_NAME=$(curl -fsL \
CURL_RESULT=$(curl -fsL \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/music-assistant/companion/releases | jq '.[0].tag_name')
https://api.github.com/repos/music-assistant/companion/releases) || exit 1
TAG_NAME=$(echo "${CURL_RESULT}" | jq '.[0].tag_name')

MUSIC_COMPANION_VERSION=$(echo "${TAG_NAME}" | cut -d"v" -f 2 | cut -d"\"" -f 1)
VERSION_CUT=$(echo "${TAG_NAME}" | cut -d"v" -f 2) || exit 1
MUSIC_COMPANION_VERSION=$(echo "${VERSION_CUT}" | cut -d"\"" -f 1) || exit 1
export MUSIC_COMPANION_VERSION

for i in "${RELEASES[@]}"
do
ARCH=$(echo "${i}" | cut -f1 -d_ | tr '[:upper:]' '[:lower:]')
ARCH_PART=$(echo "${i}" | cut -f1 -d_) || exit 1
ARCH=$(echo "${ARCH_PART}" | tr '[:upper:]' '[:lower:]') || exit 1
URL="https://github.com/music-assistant/companion/releases/download/v${MUSIC_COMPANION_VERSION}/Music.Assistant.Companion_${ARCH}.app.tar.gz"
curl -sLO "${URL}"

SHA_FILE=$(shasum -a 256 "Music.Assistant.Companion_${ARCH}.app.tar.gz" | cut -d" " -f 1)
SHA_RESULT=$(shasum -a 256 "Music.Assistant.Companion_${ARCH}.app.tar.gz") || exit 1
SHA_FILE=$(echo "${SHA_RESULT}" | cut -d" " -f 1) || exit 1

export "${i}"="${SHA_FILE}"
done
Expand Down

0 comments on commit fc2a2c6

Please sign in to comment.