Skip to content

Commit fc2a2c6

Browse files
committed
Split variables more so we can check for errors
1 parent 95009a5 commit fc2a2c6

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

check_release.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
#!/usr/bin/env bash
22
RELEASES=('AARCH64_SHA256' 'X64_SHA256')
33

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

9-
MUSIC_COMPANION_VERSION=$(echo "${TAG_NAME}" | cut -d"v" -f 2 | cut -d"\"" -f 1)
10+
VERSION_CUT=$(echo "${TAG_NAME}" | cut -d"v" -f 2) || exit 1
11+
MUSIC_COMPANION_VERSION=$(echo "${VERSION_CUT}" | cut -d"\"" -f 1) || exit 1
1012
export MUSIC_COMPANION_VERSION
1113

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

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

2024
export "${i}"="${SHA_FILE}"
2125
done

0 commit comments

Comments
 (0)