PRE_BUILD_AUTOMATION: added wildcard support to latestghrelease + sha -fix2

This commit is contained in:
XargonWan 2024-09-24 17:49:12 +09:00
parent 6930fb281a
commit 39dd36c488
2 changed files with 7 additions and 4 deletions

View file

@ -25,7 +25,7 @@ hash^RETRODECKSOLARUSLATEST^https://github.com/RetroDECK/org.solarus_games.solar
hash^RETRODECKGZDOOMLATEST^https://github.com/RetroDECK/org.zdoom.GZDoom/releases/latest/download/RetroDECK-gzdoom-Artifact.tar.gz
hash^RETRODECKMAMELATEST^https://github.com/RetroDECK/MAME/releases/latest/download/RetroDECK-MAME-Artifact.tar.gz
latestghrelease^SHADPS4LATESTGHREL^https://github.com/shadps4-emu/shadPS4/releases/latest/download/shadps4-linux-qt-*.zip
latestghrelease^SHADPS4LATESTGHREL^https://api.github.com/repos/shadps4-emu/shadPS4/releases/latest^shadps4-linux-qt-.*\.zip
latestghreleasesha^SHADPS4LATESTSHA^https://api.github.com/repos/shadps4-emu/shadPS4/releases/latest^shadps4-linux-qt-.*\.zip
#This will replace RETRODECKSHADPS4LATESTURL with the URL of the latest artifact and RETRODECKSHADPS4LATESTSHA with its SHA256 hash.

View file

@ -106,10 +106,12 @@ handle_latestghtag() {
handle_latestghrelease() {
local placeholder="$1"
local url="$2"
local api_url="$2"
local pattern="$3"
echo "Fetching release data from: $url"
local release_data=$(curl -s "$url")
echo "Fetching release data from: $api_url"
# Fetch the release data from GitHub API
local release_data=$(curl -s "$api_url")
echo "Release data fetched."
# Find the matching asset using the pattern
@ -120,6 +122,7 @@ handle_latestghrelease() {
exit 1
fi
# Download the file and compute its hash
local ghreleasehash=$(curl -sL "$ghreleaseurl" | sha256sum | cut -d ' ' -f1)
echo "Replacing placeholder $placeholder with URL $ghreleaseurl and hash $ghreleasehash"