Skip to content

Commit 8fa1f70

Browse files
committed
tweak version check [skip ci]
1 parent a07e501 commit 8fa1f70

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

update-versions.sh

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
#!/bin/bash
2+
old_version=$(jq -re '.version' < VERSION.json)
23
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
34
[[ ${version} == "develop" ]] && version=$(curl -u "${GITHUB_ACTOR}:${GITHUB_TOKEN}" -fsSL "https://api.github.com/repos/stashapp/stash/commits/develop" | jq -re .sha) || exit 1
4-
curl -fsSL "https://github.com/stashapp/stash/releases/download/latest_develop/CHECKSUMS_SHA1" -o CHECKSUMS_SHA1 || exit 1
5-
grep -q "${version:0:7}" < CHECKSUMS_SHA1 || exit 1
6-
curl -fsSL "https://github.com/stashapp/stash/releases/download/latest_develop/stash-linux" -o stash || exit 1
7-
checksum="$(sha1sum stash | awk '{print $1}')"
8-
grep -q "${checksum}" < CHECKSUMS_SHA1 || exit 1
9-
rm -rf CHECKSUMS_SHA1 stash
10-
json=$(cat VERSION.json)
11-
jq --sort-keys \
12-
--arg version "${version//v/}" \
13-
'.version = $version' <<< "${json}" | tee VERSION.json
5+
if [[ "${version}" != "${old_version}" ]]; then
6+
curl -fsSL "https://github.com/stashapp/stash/releases/download/latest_develop/CHECKSUMS_SHA1" -o CHECKSUMS_SHA1 || exit 1
7+
grep -q "${version:0:7}" < CHECKSUMS_SHA1 || exit 1
8+
curl -fsSL "https://github.com/stashapp/stash/releases/download/latest_develop/stash-linux" -o stash || exit 1
9+
checksum="$(sha1sum stash | awk '{print $1}')"
10+
grep -q "${checksum}" < CHECKSUMS_SHA1 || exit 1
11+
rm -rf CHECKSUMS_SHA1 stash
12+
json=$(cat VERSION.json)
13+
jq --sort-keys \
14+
--arg version "${version//v/}" \
15+
'.version = $version' <<< "${json}" | tee VERSION.json
16+
fi

0 commit comments

Comments
 (0)