mirror of
https://codefloe.com/Jonas8272/scoop-bucket.git
synced 2026-11-30 23:09:35 +00:00
revert 460c1aef74
revert socialstreamninja: track pre-release (test) builds instead of stable only
This commit is contained in:
1 parent
0a24cf9e2a
commit
2ea8349ce6
2 files changed
+16
-30
No files matched your search
@@ -13,14 +13,9 @@
|
||||
]
|
||||
],
|
||||
"persist": "SocialStreamNinja-data",
|
||||
"notes": [
|
||||
"Export your settings from the app before updating.",
|
||||
"This bucket tracks the pre-release (test) builds of Social Stream Ninja, not only the stable ones."
|
||||
],
|
||||
"notes": "Export your settings from the app before updating.",
|
||||
"checkver": {
|
||||
"url": "https://api.github.com/repos/steveseguin/social_stream/releases?per_page=10",
|
||||
"jsonpath": "$[0].tag_name",
|
||||
"regex": "v([\\d.]+)"
|
||||
"github": "https://github.com/steveseguin/social_stream"
|
||||
},
|
||||
"autoupdate": {
|
||||
"url": "https://github.com/steveseguin/social_stream/releases/download/v$version/socialstreamninja-portable.exe"
|
||||
|
||||
@@ -3,50 +3,41 @@ set -euo pipefail
|
||||
|
||||
M=bucket/socialstreamninja.json
|
||||
REPO=steveseguin/social_stream
|
||||
ASSET=socialstreamninja-portable.exe
|
||||
ASSET='^socialstreamninja-portable\.exe$'
|
||||
|
||||
auth=()
|
||||
if [ -n "${GH_API_TOKEN:-}" ]; then
|
||||
auth=(-H "Authorization: Bearer $GH_API_TOKEN")
|
||||
fi
|
||||
|
||||
rels=$(curl -fsSL ${auth[@]+"${auth[@]}"} "https://api.github.com/repos/$REPO/releases?per_page=50")
|
||||
|
||||
# Highest versioned tag (vA.B.C) among ALL non-draft releases, pre-releases and
|
||||
# test builds included, that already has the portable exe uploaded.
|
||||
rel=$(jq -c --arg a "$ASSET" '
|
||||
[ .[]
|
||||
| select(.draft == false)
|
||||
| select(.tag_name | test("^v[0-9]+(\\.[0-9]+)+$"))
|
||||
| select(any(.assets[]; .name == $a)) ]
|
||||
| sort_by(.tag_name | ltrimstr("v") | split(".") | map(tonumber))
|
||||
| last // empty' <<<"$rels")
|
||||
|
||||
[ -n "$rel" ] || { echo "no release with $ASSET found" >&2; exit 1; }
|
||||
|
||||
rel=$(curl -fsSL ${auth[@]+"${auth[@]}"} "https://api.github.com/repos/$REPO/releases/latest")
|
||||
tag=$(jq -r .tag_name <<<"$rel")
|
||||
ver=${tag#v}
|
||||
cur=$(jq -r .version "$M")
|
||||
|
||||
# Up to date, or the manifest is already ahead (for example a pre-release was
|
||||
# deleted): leave it alone so it never goes backwards.
|
||||
if [ "$(printf '%s\n%s\n' "$cur" "$ver" | sort -V | tail -n1)" = "$cur" ]; then
|
||||
if [ "$ver" = "$cur" ]; then
|
||||
echo "up to date ($cur)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
url="https://github.com/$REPO/releases/download/$tag/$ASSET"
|
||||
name=$(jq -r '.assets[].name' <<<"$rel" | grep -E "$ASSET" || true)
|
||||
if [ "$(printf '%s\n' "$name" | grep -c .)" -ne 1 ]; then
|
||||
echo "expected exactly one asset matching /$ASSET/ in $tag, got:" >&2
|
||||
echo "$name" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
url="https://github.com/$REPO/releases/download/$tag/$name"
|
||||
|
||||
# Prefer GitHub's recorded digest; otherwise download and hash the file.
|
||||
hash=$(jq -r --arg n "$ASSET" '.assets[] | select(.name==$n) | .digest // empty' <<<"$rel" | sed 's/^sha256://')
|
||||
hash=$(jq -r --arg n "$name" '.assets[] | select(.name==$n) | .digest // empty' <<<"$rel" | sed 's/^sha256://')
|
||||
if ! [[ $hash =~ ^[0-9a-f]{64}$ ]]; then
|
||||
echo "no API digest for $ASSET, downloading to hash it" >&2
|
||||
echo "no API digest for $name, downloading to hash it" >&2
|
||||
curl -fsSL -o /tmp/asset "$url"
|
||||
[ "$(head -c2 /tmp/asset)" = "MZ" ] || { echo "$ASSET is not an exe" >&2; exit 1; }
|
||||
hash=$(sha256sum /tmp/asset | cut -d' ' -f1)
|
||||
fi
|
||||
|
||||
jq --indent 4 --arg v "$ver" --arg u "$url" --arg h "$hash" \
|
||||
'.version=$v | .url=$u | .hash=$h' "$M" > "$M.tmp" && mv "$M.tmp" "$M"
|
||||
|
||||
echo "updated $cur -> $ver ($(jq -r .prerelease <<<"$rel" | sed 's/true/pre-release/; s/false/stable/'))"
|
||||
echo "updated $cur -> $ver"
|
||||
Reference in new issue
Block a user