From 39dd36c4885cbc687fc6d1b4e1a1140000aa2d4d Mon Sep 17 00:00:00 2001 From: XargonWan Date: Tue, 24 Sep 2024 17:49:12 +0900 Subject: [PATCH] PRE_BUILD_AUTOMATION: added wildcard support to latestghrelease + sha -fix2 --- automation_tools/automation_task_list.cfg | 2 +- automation_tools/pre_build_automation.sh | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/automation_tools/automation_task_list.cfg b/automation_tools/automation_task_list.cfg index fdd0ed1c..e1dd57b8 100644 --- a/automation_tools/automation_task_list.cfg +++ b/automation_tools/automation_task_list.cfg @@ -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. diff --git a/automation_tools/pre_build_automation.sh b/automation_tools/pre_build_automation.sh index d4151e16..c40f5b79 100755 --- a/automation_tools/pre_build_automation.sh +++ b/automation_tools/pre_build_automation.sh @@ -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"