mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2024-11-25 07:25:38 +00:00
PRE_BUILD_AUTOMATION: added wildcard support to latestghrelease + sha
This commit is contained in:
parent
fd4e3e51a6
commit
41147e93db
|
@ -24,7 +24,9 @@ hash^RETRODECKMELONDSLATEST^https://github.com/RetroDECK/net.kuribo64.melonDS/re
|
|||
hash^RETRODECKSOLARUSLATEST^https://github.com/RetroDECK/org.solarus_games.solarus.Launcher/releases/latest/download/RetroDECK-solarus-Artifact.tar.gz
|
||||
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
|
||||
hash^RETRODECKSHADPS4LATESTSTABLE^https://github.com/shadps4-emu/shadPS4/releases/download/Pre-release-shadPS4-2024-09-24-1620eea/shadps4-linux-qt-2024-09-24-1620eea.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
|
||||
|
||||
#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
|
||||
|
|
|
@ -107,14 +107,16 @@ handle_latestghtag() {
|
|||
handle_latestghrelease() {
|
||||
local placeholder="$1"
|
||||
local url="$2"
|
||||
local suffix="$3"
|
||||
local pattern="$3"
|
||||
echo "Fetching release data from: $url"
|
||||
local release_data=$(curl -s "$url")
|
||||
echo "Release data fetched."
|
||||
local ghreleaseurl=$(echo "$release_data" | jq -r ".assets[] | select(.name | endswith(\"$suffix\")).browser_download_url")
|
||||
|
||||
# Find the matching asset using the pattern
|
||||
local ghreleaseurl=$(echo "$release_data" | jq -r ".assets[] | select(.name | test(\"$pattern\")).browser_download_url")
|
||||
|
||||
if [[ -z "$ghreleaseurl" ]]; then
|
||||
echo "Error: No asset found with suffix $suffix"
|
||||
echo "Error: No asset found matching pattern $pattern"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -128,17 +130,20 @@ handle_latestghrelease() {
|
|||
handle_latestghreleasesha() {
|
||||
local placeholder="$1"
|
||||
local url="$2"
|
||||
local suffix="$3"
|
||||
local pattern="$3"
|
||||
echo "Fetching release data from: $url"
|
||||
local release_data=$(curl -s "$url")
|
||||
echo "Release data fetched."
|
||||
local ghreleaseurl=$(echo "$release_data" | jq -r ".assets[] | select(.name | endswith(\"$suffix\")).browser_download_url")
|
||||
|
||||
# Find the matching asset using the pattern
|
||||
local ghreleaseurl=$(echo "$release_data" | jq -r ".assets[] | select(.name | test(\"$pattern\")).browser_download_url")
|
||||
|
||||
if [[ -z "$ghreleaseurl" ]]; then
|
||||
echo "Error: No asset found with suffix $suffix"
|
||||
echo "Error: No asset found matching pattern $pattern"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Download the file and compute its hash
|
||||
local ghreleasehash=$(curl -sL "$ghreleaseurl" | sha256sum | cut -d ' ' -f1)
|
||||
|
||||
echo "Replacing placeholder $placeholder with hash $ghreleasehash"
|
||||
|
|
Loading…
Reference in a new issue