From 0cc66841c2e578ec2ae5daea3cf0756641331402 Mon Sep 17 00:00:00 2001 From: XargonWan Date: Tue, 23 Jan 2024 14:22:55 +0100 Subject: [PATCH] AUTOMATION: urls can be now be calculated from an expression + new action addition: url that solery calculate the expanded url --- automation_tools/automation_task_list.cfg | 3 ++- automation_tools/pre_build_automation.sh | 13 +++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/automation_tools/automation_task_list.cfg b/automation_tools/automation_task_list.cfg index 2bcac447..4b2b7788 100644 --- a/automation_tools/automation_task_list.cfg +++ b/automation_tools/automation_task_list.cfg @@ -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 diff --git a/automation_tools/pre_build_automation.sh b/automation_tools/pre_build_automation.sh index 0c47f854..9c363c96 100755 --- a/automation_tools/pre_build_automation.sh +++ b/automation_tools/pre_build_automation.sh @@ -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"