PRE_BUILD_AUTOMATION: added wildcard support to latestghrelease + sha -fix1

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

View file

@ -26,7 +26,7 @@ hash^RETRODECKGZDOOMLATEST^https://github.com/RetroDECK/org.zdoom.GZDoom/release
hash^RETRODECKMAMELATEST^https://github.com/RetroDECK/MAME/releases/latest/download/RetroDECK-MAME-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://github.com/shadps4-emu/shadPS4/releases/latest/download/shadps4-linux-qt-*.zip
latestghreleasesha^SHADPS4LATESTSHA^https://github.com/shadps4-emu/shadPS4/releases/latest/download/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. #This will replace RETRODECKSHADPS4LATESTURL with the URL of the latest artifact and RETRODECKSHADPS4LATESTSHA with its SHA256 hash.
#latestghaartifact^RETRODECKSHADPS4LATESTURL^RETRODECKSHADPS4LATESTSHA^https://github.com/shadps4-emu/shadPS4/actions/workflows/linux-qt.yml^shadps4-linux-qt #latestghaartifact^RETRODECKSHADPS4LATESTURL^RETRODECKSHADPS4LATESTSHA^https://github.com/shadps4-emu/shadPS4/actions/workflows/linux-qt.yml^shadps4-linux-qt

View file

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