diff --git a/automation_tools/automation_task_list.cfg b/automation_tools/automation_task_list.cfg index d096ffe9..d5328d60 100644 --- a/automation_tools/automation_task_list.cfg +++ b/automation_tools/automation_task_list.cfg @@ -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://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. #latestghaartifact^RETRODECKSHADPS4LATESTURL^RETRODECKSHADPS4LATESTSHA^https://github.com/shadps4-emu/shadPS4/actions/workflows/linux-qt.yml^shadps4-linux-qt diff --git a/automation_tools/pre_build_automation.sh b/automation_tools/pre_build_automation.sh index dd8d63fd..c40f5b79 100755 --- a/automation_tools/pre_build_automation.sh +++ b/automation_tools/pre_build_automation.sh @@ -106,20 +106,25 @@ handle_latestghtag() { handle_latestghrelease() { local placeholder="$1" - local url="$2" - local suffix="$3" - echo "Fetching release data from: $url" - local release_data=$(curl -s "$url") + local api_url="$2" + local pattern="$3" + 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." - 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 URL $ghreleaseurl and hash $ghreleasehash" /bin/sed -i 's^'"$placeholder"'^'"$ghreleaseurl"'^g' "$rd_manifest" /bin/sed -i 's^'"HASHFOR$placeholder"'^'"$ghreleasehash"'^g' "$rd_manifest" @@ -127,20 +132,26 @@ handle_latestghrelease() { handle_latestghreleasesha() { local placeholder="$1" - local url="$2" - local suffix="$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") + local api_url="$2" + local pattern="$3" + 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 + 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 + echo "Downloading asset to compute hash: $ghreleaseurl" local ghreleasehash=$(curl -sL "$ghreleaseurl" | sha256sum | cut -d ' ' -f1) - + echo "Replacing placeholder $placeholder with hash $ghreleasehash" /bin/sed -i 's^'"$placeholder"'^'"$ghreleasehash"'^g' "$rd_manifest" } diff --git a/net.retrodeck.retrodeck.yml b/net.retrodeck.retrodeck.yml index 040dddb3..a60f6dac 100644 --- a/net.retrodeck.retrodeck.yml +++ b/net.retrodeck.retrodeck.yml @@ -616,9 +616,8 @@ modules: - cp -r squashfs-root/usr/* "${FLATPAK_DEST}/" sources: - type: archive - url: https://github.com/shadps4-emu/shadPS4/releases/download/Pre-release-shadPS4-2024-09-24-1620eea/shadps4-linux-qt-2024-09-24-1620eea.zip - sha256: RETRODECKSHADPS4LATESTSTABLE - + url: SHADPS4LATESTGHREL + sha256: SHADPS4LATESTSHA # PortMaster - name: PortMaster