Merge pull request #662 from icenine451/cooker-0.8.0b-icenine451

Cooker 0.8.0b icenine451
This commit is contained in:
icenine451 2024-01-24 11:43:53 -05:00 committed by GitHub
commit 2609c642d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 53 additions and 9 deletions

View file

@ -11,5 +11,5 @@ hash^RANIGHTLYCORESPLACEHOLDER^https://buildbot.libretro.com/nightly/linux/x86_6
hash^RETRODECKMAMEPLACEHOLDER^"https://github.com/XargonWan/RetroDECK-MAME/releases/download/$(curl -s https://api.github.com/repos/XargonWan/RetroDECK-MAME/releases/latest | grep -oP '"tag_name": "\K(.*?)(?=")')/RetroDECK-MAME-Artifact.tar.gz" hash^RETRODECKMAMEPLACEHOLDER^"https://github.com/XargonWan/RetroDECK-MAME/releases/download/$(curl -s https://api.github.com/repos/XargonWan/RetroDECK-MAME/releases/latest | grep -oP '"tag_name": "\K(.*?)(?=")')/RetroDECK-MAME-Artifact.tar.gz"
url^RETRODECKMAMEURLPLACEHOLDER^"https://github.com/XargonWan/RetroDECK-MAME/releases/download/$(curl -s https://api.github.com/repos/XargonWan/RetroDECK-MAME/releases/latest | grep -oP '"tag_name": "\K(.*?)(?=")')/RetroDECK-MAME-Artifact.tar.gz" url^RETRODECKMAMEURLPLACEHOLDER^"https://github.com/XargonWan/RetroDECK-MAME/releases/download/$(curl -s https://api.github.com/repos/XargonWan/RetroDECK-MAME/releases/latest | grep -oP '"tag_name": "\K(.*?)(?=")')/RetroDECK-MAME-Artifact.tar.gz"
latestcommit^UNIVERSALDYNAMICINPUTCOMMITPLACEHOLDER^https://github.com/Venomalia/UniversalDynamicInput^main latestcommit^UNIVERSALDYNAMICINPUTCOMMITPLACEHOLDER^https://github.com/Venomalia/UniversalDynamicInput^main
outside_info^VERSIONPLACEHOLDER^${GITHUB_WORKSPACE}/buildid outside_file^VERSIONPLACEHOLDER^${GITHUB_WORKSPACE}/buildid
branch^THISBRANCH branch^THISBRANCH

View file

@ -3,15 +3,21 @@
# For the file paths to work correctly, call this script with this command from the cloned repo folder root: # For the file paths to work correctly, call this script with this command from the cloned repo folder root:
# sh automation_tools/pre_build_automation.sh # sh automation_tools/pre_build_automation.sh
# Different actions need different information in the task list file # Different actions need different information in the task list file
# branch: This changes the placeholder text to the currently-detected GIT branch if an automated build was started from a PR environment.
# hash: Finds the SHA256 hash of a file online and updates the placeholder in the manifest. # hash: Finds the SHA256 hash of a file online and updates the placeholder in the manifest.
# Needs the URL of the file, in this line format: hash^PLACEHOLDERTEXT^url # Needs the URL of the file, in this line format: hash^PLACEHOLDERTEXT^url
# latestcommit: Finds the most recent commit of a git repo and updated the placeholder in the manifest. # latestcommit: Finds the most recent commit of a git repo and updated the placeholder in the manifest.
# Needs the URL of the repo and the branch to find the latest commit from, in this line format: latestcommit^PLACEHOLDERTEXT^url^branch # Needs the URL of the repo and the branch to find the latest commit from, in this line format: latestcommit^PLACEHOLDERTEXT^url^branch
# latestappimage: Finds the download URL and SHA256 hash of the latest AppImage release from a git repo # latestappimage: Finds the download URL and SHA256 hash of the latest AppImage release from a git repo.
# Needs the API URL of the repo, in this line format: latestappimage^PLACEHOLDERTEXT^https://api.github.com/repos/<owner-name>/<repo-name>/releases/latest # Needs the API URL of the repo, in this line format: latestappimage^PLACEHOLDERTEXT^https://api.github.com/repos/<owner-name>/<repo-name>/releases/latest
# As this command updates two different placeholders (one for the URL, one for the file hash) in the manifest, # As this command updates two different placeholders (one for the URL, one for the file hash) in the manifest,
# the URL that would be used in the above example is "PLACEHOLDERTEXT" and the hash placeholder text would be "HASHPLACEHOLDERTEXT" # the URL that would be used in the above example is "PLACEHOLDERTEXT" and the hash placeholder text would be "HASHPLACEHOLDERTEXT"
# The "HASH" prefix of the placeholder text is hardcoded in the script # The "HASH" prefix of the placeholder text is hardcoded in the script
# outside_file: Prints the contents of a file from the build environment (such as the buildid file) and replaces the placeholder text with those contents.
# outside_env_var: Gets the value of an environmental variable from the build environment (the output of "echo $var" from the terminal) and replaces the placeholder text with that value.
# custom_command: Runs a single command explicitly as written in the $URL field of the task list, including variable and command expansion. This should work the same as if you were runnig the command directly from the terminal.
# This command does not need a PLACEHOLDERTEXT field in the task list, so needs to be in this syntax: custom_command^^$COMMAND
# url: This is used to calculate a dynamic URL and the value to the $caluculated_url environmental variable, for use in other subsequent commands.
rd_manifest=${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml rd_manifest=${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml
automation_task_list=${GITHUB_WORKSPACE}/automation_tools/automation_task_list.cfg automation_task_list=${GITHUB_WORKSPACE}/automation_tools/automation_task_list.cfg
@ -35,13 +41,17 @@ echo
while IFS="^" read -r action placeholder url branch while IFS="^" read -r action placeholder url branch
do do
if [[ ! $action == "#"* ]] && [[ ! -z "$action" ]]; then if [[ ! $action == "#"* ]] && [[ ! -z "$action" ]]; then
if [[ "$action" == "branch" ]]; then case "$action" in
"branch" )
echo echo
echo "Placeholder text: $placeholder" echo "Placeholder text: $placeholder"
echo "Current branch:" "$current_branch" echo "Current branch:" "$current_branch"
echo echo
/bin/sed -i 's^'"$placeholder"'^'"$current_branch"'^g' $rd_manifest /bin/sed -i 's^'"$placeholder"'^'"$current_branch"'^g' $rd_manifest
elif [[ "$action" == "hash" ]]; then ;;
"hash" )
echo echo
echo "Placeholder text: $placeholder" echo "Placeholder text: $placeholder"
calculated_url=$(eval echo "$url") # in case the url has to be calculated from an expression calculated_url=$(eval echo "$url") # in case the url has to be calculated from an expression
@ -50,7 +60,9 @@ do
hash=$(curl -sL "$calculated_url" | sha256sum | cut -d ' ' -f1) hash=$(curl -sL "$calculated_url" | sha256sum | cut -d ' ' -f1)
echo "Hash found: $hash" echo "Hash found: $hash"
/bin/sed -i 's^'"$placeholder"'^'"$hash"'^' $rd_manifest /bin/sed -i 's^'"$placeholder"'^'"$hash"'^' $rd_manifest
elif [[ "$action" == "latestcommit" ]]; then ;;
"latestcommit" )
echo echo
echo "Placeholder text: $placeholder" echo "Placeholder text: $placeholder"
echo "Repo to get latest commit from: $url branch: $branch" echo "Repo to get latest commit from: $url branch: $branch"
@ -58,7 +70,9 @@ do
commit=$(git ls-remote "$url" "$branch" | cut -f1) commit=$(git ls-remote "$url" "$branch" | cut -f1)
echo "Commit found: $commit" echo "Commit found: $commit"
/bin/sed -i 's^'"$placeholder"'^'"$commit"'^' $rd_manifest /bin/sed -i 's^'"$placeholder"'^'"$commit"'^' $rd_manifest
elif [[ "$action" == "latestappimage" ]]; then ;;
"latestappimage" )
echo echo
echo "Placeholder text: $placeholder" echo "Placeholder text: $placeholder"
echo "Repo to look for AppImage releases: $url" echo "Repo to look for AppImage releases: $url"
@ -69,7 +83,9 @@ do
appimagehash=$(curl -sL "$appimageurl" | sha256sum | cut -d ' ' -f1) appimagehash=$(curl -sL "$appimageurl" | sha256sum | cut -d ' ' -f1)
echo "AppImage hash found: $appimagehash" echo "AppImage hash found: $appimagehash"
/bin/sed -i 's^'"HASHFOR$placeholder"'^'"$appimagehash"'^' $rd_manifest /bin/sed -i 's^'"HASHFOR$placeholder"'^'"$appimagehash"'^' $rd_manifest
elif [[ "$action" == "outside_info" ]]; then ;;
"outside_file" )
if [[ "$url" = \$* ]]; then # If value is a reference to a variable name if [[ "$url" = \$* ]]; then # If value is a reference to a variable name
eval url="$url" eval url="$url"
fi fi
@ -78,7 +94,27 @@ do
echo "Information being injected: $(cat $url)" echo "Information being injected: $(cat $url)"
echo echo
/bin/sed -i 's^'"$placeholder"'^'"$(cat $url)"'^' $rd_manifest /bin/sed -i 's^'"$placeholder"'^'"$(cat $url)"'^' $rd_manifest
elif [[ "$action" == "url" ]]; then ;;
"outside_env_var" )
if [[ "$url" = \$* ]]; then # If value is a reference to a variable name
eval url="$url"
fi
echo
echo "Placeholder text: $placeholder"
echo "Information being injected: $(echo $url)"
echo
/bin/sed -i 's^'"$placeholder"'^'"$(echo $url)"'^' $rd_manifest
;;
"custom_command" )
echo
echo "Command to run: $url"
echo
eval "$url"
;;
"url" )
# this is used to calculate a dynamic url # this is used to calculate a dynamic url
echo echo
echo "Placeholder text: $placeholder" echo "Placeholder text: $placeholder"
@ -86,6 +122,8 @@ do
echo "Information being injected: $calculated_url" echo "Information being injected: $calculated_url"
echo echo
/bin/sed -i 's^'"$placeholder"'^'"$calculated_url"'^' $rd_manifest /bin/sed -i 's^'"$placeholder"'^'"$calculated_url"'^' $rd_manifest
fi ;;
esac
fi fi
done < "$automation_task_list" done < "$automation_task_list"

View file

@ -29,7 +29,13 @@ gba
gbc gbc
genesis genesis
mastersystem mastersystem
n64
nds nds
nes nes
ngp
ngpc
sega32x
sega32xjp
sega32xna
snes snes
snesna snesna