AUTOMATION: urls can be now be calculated from an expression + new action addition: url that solery calculate the expanded url

This commit is contained in:
XargonWan 2024-01-23 14:22:55 +01:00
parent 14c66ae4d7
commit 0cc66841c2
2 changed files with 13 additions and 3 deletions

View file

@ -8,7 +8,8 @@ hash^MSXBIOSHASHPLACEHOLDER^http://bluemsx.msxblue.com/rel_download/blueMSXv282f
hash^XEMUHDDHASHPLACEHOLDER^https://github.com/mborgerson/xemu-hdd-image/releases/latest/download/xbox_hdd.qcow2.zip
hash^VITA3KSHAPLACEHOLDER^https://github.com/Vita3K/Vita3K/releases/download/continuous/ubuntu-latest.zip
hash^RANIGHTLYCORESPLACEHOLDER^https://buildbot.libretro.com/nightly/linux/x86_64/RetroArch_cores.7z
#hash^RETRODECKMAMEPLACEHOLDER^
hash^RETRODECKMAMEPLACEHOLDER^https://github.com/XargonWan/RetroDECK-MAME/archive/refs/tags/$(curl -s https://api.github.com/repos/XargonWan/RetroDECK-MAME/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')-Artifact.tar.gz
url^RETRODECKMAMEPLACEHOLDERURL^https://github.com/XargonWan/RetroDECK-MAME/archive/refs/tags/$(curl -s https://api.github.com/repos/XargonWan/RetroDECK-MAME/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')-Artifact.tar.gz
latestcommit^UNIVERSALDYNAMICINPUTCOMMITPLACEHOLDER^https://github.com/Venomalia/UniversalDynamicInput^main
outside_info^VERSIONPLACEHOLDER^${GITHUB_WORKSPACE}/buildid
branch^THISBRANCH

View file

@ -44,9 +44,10 @@ do
elif [[ "$action" == "hash" ]]; then
echo
echo "Placeholder text: $placeholder"
echo "URL to hash: $url"
calculated_url=$(eval echo "$url") # in case the url has to be calculated from an expression
echo "URL to hash: $calculated_url"
echo
hash=$(curl -sL "$url" | sha256sum | cut -d ' ' -f1)
hash=$(curl -sL "$calculated_url" | sha256sum | cut -d ' ' -f1)
echo "Hash found: $hash"
/bin/sed -i 's^'"$placeholder"'^'"$hash"'^' $rd_manifest
elif [[ "$action" == "latestcommit" ]]; then
@ -77,6 +78,14 @@ do
echo "Information being injected: $(cat $url)"
echo
/bin/sed -i 's^'"$placeholder"'^'"$(cat $url)"'^' $rd_manifest
elif [[ "$action" == "url" ]]; then
# this is used to calculate a dynamic url
echo
echo "Placeholder text: $placeholder"
calculated_url=$(eval echo "$url")
echo "Information being injected: $calculated_url"
echo
/bin/sed -i 's^'"$placeholder"'^'"$calculated_url"'^' $rd_manifest
fi
fi
done < "$automation_task_list"