Skip to content

Commit

Permalink
tweak version check [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
mrhotio committed Feb 12, 2024
1 parent a07e501 commit 8fa1f70
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions update-versions.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
#!/bin/bash
old_version=$(jq -re '.version' < VERSION.json)
version=$(curl -u "${GITHUB_ACTOR}:${GITHUB_TOKEN}" -fsSL "https://api.github.com/repos/stashapp/stash/releases/tags/latest_develop" | jq -re .target_commitish) || exit 1
[[ ${version} == "develop" ]] && version=$(curl -u "${GITHUB_ACTOR}:${GITHUB_TOKEN}" -fsSL "https://api.github.com/repos/stashapp/stash/commits/develop" | jq -re .sha) || exit 1
curl -fsSL "https://github.com/stashapp/stash/releases/download/latest_develop/CHECKSUMS_SHA1" -o CHECKSUMS_SHA1 || exit 1
grep -q "${version:0:7}" < CHECKSUMS_SHA1 || exit 1
curl -fsSL "https://github.com/stashapp/stash/releases/download/latest_develop/stash-linux" -o stash || exit 1
checksum="$(sha1sum stash | awk '{print $1}')"
grep -q "${checksum}" < CHECKSUMS_SHA1 || exit 1
rm -rf CHECKSUMS_SHA1 stash
json=$(cat VERSION.json)
jq --sort-keys \
--arg version "${version//v/}" \
'.version = $version' <<< "${json}" | tee VERSION.json
if [[ "${version}" != "${old_version}" ]]; then
curl -fsSL "https://github.com/stashapp/stash/releases/download/latest_develop/CHECKSUMS_SHA1" -o CHECKSUMS_SHA1 || exit 1
grep -q "${version:0:7}" < CHECKSUMS_SHA1 || exit 1
curl -fsSL "https://github.com/stashapp/stash/releases/download/latest_develop/stash-linux" -o stash || exit 1
checksum="$(sha1sum stash | awk '{print $1}')"
grep -q "${checksum}" < CHECKSUMS_SHA1 || exit 1
rm -rf CHECKSUMS_SHA1 stash
json=$(cat VERSION.json)
jq --sort-keys \
--arg version "${version//v/}" \
'.version = $version' <<< "${json}" | tee VERSION.json
fi

0 comments on commit 8fa1f70

Please sign in to comment.