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^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^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^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.
|
#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
|
||||||
|
|
|
@ -107,19 +107,21 @@ handle_latestghtag() {
|
||||||
handle_latestghrelease() {
|
handle_latestghrelease() {
|
||||||
local placeholder="$1"
|
local placeholder="$1"
|
||||||
local url="$2"
|
local url="$2"
|
||||||
local suffix="$3"
|
local pattern="$3"
|
||||||
echo "Fetching release data from: $url"
|
echo "Fetching release data from: $url"
|
||||||
local release_data=$(curl -s "$url")
|
local release_data=$(curl -s "$url")
|
||||||
echo "Release data fetched."
|
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
|
if [[ -z "$ghreleaseurl" ]]; then
|
||||||
echo "Error: No asset found with suffix $suffix"
|
echo "Error: No asset found matching pattern $pattern"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local ghreleasehash=$(curl -sL "$ghreleaseurl" | sha256sum | cut -d ' ' -f1)
|
local ghreleasehash=$(curl -sL "$ghreleaseurl" | sha256sum | cut -d ' ' -f1)
|
||||||
|
|
||||||
echo "Replacing placeholder $placeholder with URL $ghreleaseurl and hash $ghreleasehash"
|
echo "Replacing placeholder $placeholder with URL $ghreleaseurl and hash $ghreleasehash"
|
||||||
/bin/sed -i 's^'"$placeholder"'^'"$ghreleaseurl"'^g' "$rd_manifest"
|
/bin/sed -i 's^'"$placeholder"'^'"$ghreleaseurl"'^g' "$rd_manifest"
|
||||||
/bin/sed -i 's^'"HASHFOR$placeholder"'^'"$ghreleasehash"'^g' "$rd_manifest"
|
/bin/sed -i 's^'"HASHFOR$placeholder"'^'"$ghreleasehash"'^g' "$rd_manifest"
|
||||||
|
@ -128,19 +130,22 @@ handle_latestghrelease() {
|
||||||
handle_latestghreleasesha() {
|
handle_latestghreleasesha() {
|
||||||
local placeholder="$1"
|
local placeholder="$1"
|
||||||
local url="$2"
|
local url="$2"
|
||||||
local suffix="$3"
|
local pattern="$3"
|
||||||
echo "Fetching release data from: $url"
|
echo "Fetching release data from: $url"
|
||||||
local release_data=$(curl -s "$url")
|
local release_data=$(curl -s "$url")
|
||||||
echo "Release data fetched."
|
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
|
if [[ -z "$ghreleaseurl" ]]; then
|
||||||
echo "Error: No asset found with suffix $suffix"
|
echo "Error: No asset found matching pattern $pattern"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Download the file and compute its hash
|
||||||
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"
|
||||||
/bin/sed -i 's^'"$placeholder"'^'"$ghreleasehash"'^g' "$rd_manifest"
|
/bin/sed -i 's^'"$placeholder"'^'"$ghreleasehash"'^g' "$rd_manifest"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue