Merge branch 'cooker' into feat/steam-rom-manager

This commit is contained in:
XargonWan 2024-08-28 13:34:06 +09:00
commit ed6c98aa0b
5082 changed files with 84946 additions and 10509 deletions

View file

@ -5,19 +5,17 @@ on:
branches: branches:
- cooker* - cooker*
- feat* - feat*
- branch/cooker*
paths: paths:
- '.github/workflows/**' - '.github/workflows/**'
- 'automation_tools/**' - 'automation_tools/**'
- 'emu-configs/**' - 'config/**'
- 'es-configs/**'
- 'functions/**' - 'functions/**'
- 'rd-submodules/**' - 'rd-submodules/**'
- '*.sh' - '*.sh'
- 'net.retrodeck.retrodeck.yml' - 'net.retrodeck.retrodeck.yml'
- 'net.retrodeck.retrodeck.appdata.xml' - 'net.retrodeck.retrodeck.appdata.xml'
pull_request: pull_request:
branches:
- cooker*
# Italy (CET): 11:00 PM # Italy (CET): 11:00 PM
# Japan (JST): 7:00 AM # Japan (JST): 7:00 AM
@ -26,6 +24,9 @@ on:
workflow_dispatch: workflow_dispatch:
permissions:
contents: write
jobs: jobs:
Building_RetroDECK: Building_RetroDECK:
@ -34,14 +35,25 @@ jobs:
# Circumventing this bug: https://github.com/flatpak/flatpak-builder/issues/317 # Circumventing this bug: https://github.com/flatpak/flatpak-builder/issues/317
- name: Remove stuck mounts - name: Remove stuck mounts
run: sudo umount -f /home/ubuntu/actions-runner/_work/RetroDECK/RetroDECK/.flatpak-builder/rofiles/* run: |
sudo umount -f /home/ubuntu/actions-runner/_work/RetroDECK/RetroDECK/.flatpak-builder/rofiles/*
sudo umount -f $HOME/actions-run/_work/RetroDECK/RetroDECK/.flatpak-builder/rofiles/*
continue-on-error: true continue-on-error: true
- name: Generate a token for Rekku
id: generate-rekku-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.REKKU_APP_ID }}
private-key: ${{ secrets.REKKU_PRIVATE_KEY }}
repositories: "RetroDECK,Cooker"
owner: "RetroDECK"
- name: Clone RetroDECK repo - name: Clone RetroDECK repo
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
submodules: 'true' submodules: 'true'
- name: "Install dependencies" - name: "Install dependencies"
run: "automation_tools/install_dependencies.sh" run: "automation_tools/install_dependencies.sh"
@ -50,35 +62,46 @@ jobs:
- name: Get branch name - name: Get branch name
id: branch_name id: branch_name
run: echo "BRANCH_NAME=$(echo $GITHUB_REF | sed 's|refs/heads/||')" >> $GITHUB_ENV
# if it's a feature branch it will not marked as "latest" cooker version
- name: "Set makeLatest (cooker only)"
run: | run: |
if [[ "$BRANCH_NAME" == 'feat/'* || "$BRANCH_NAME" == 'refs/'* ]]; then if [[ "$GITHUB_EVENT_NAME" == "pull_request" || "$GITHUB_EVENT_NAME" == "pull_request_target" ]]; then
echo "MAKE_LATEST=false" >> $GITHUB_ENV source_branch="${{ github.head_ref }}"
echo "BRANCH_NAME=$source_branch" >> $GITHUB_ENV
else else
echo "MAKE_LATEST=true" >> $GITHUB_ENV branch_name=$(echo $GITHUB_REF | sed 's|refs/heads/||')
echo "BRANCH_NAME=$branch_name" >> $GITHUB_ENV
fi fi
# if the branch is coming from a PR the tag should be manually built # if the branch is coming from a PR the tag should be manually built
- name: "Generate version tag" - name: "Generate version tag and evaluating latest tag"
run: | run: |
# Source the version extractor script to get the manifest version
source automation_tools/version_extractor.sh source automation_tools/version_extractor.sh
MANIFEST_VERSION="$(fetch_manifest_version)" MANIFEST_VERSION="$(fetch_manifest_version)"
echo "MANIFEST_VERSION=$MANIFEST_VERSION" >> $GITHUB_ENV echo "MANIFEST_VERSION=$MANIFEST_VERSION" >> $GITHUB_ENV
if [[ "$BRANCH_NAME" == 'refs/'* ]]; then
pr_number=$(echo ${{env.BRANCH_NAME}} | awk -F'/' '{print $3}') # Check if the event is related to a pull request
source_branch=$(curl -s "https://api.github.com/repos/RetroDECK/RetroDECK/pulls/$pr_number" | jq -r '.head.ref') if [[ "$GITHUB_EVENT_NAME" == "pull_request" || "$GITHUB_EVENT_NAME" == "pull_request_target" ]]; then
# Use GITHUB_HEAD_REF to get the source branch
source_branch="${GITHUB_HEAD_REF}"
# Replace '/' with '-' in the branch name
source_branch=${source_branch//\//-} source_branch=${source_branch//\//-}
echo "[DEBUG] source branch is: $source_branch" echo "[DEBUG] source branch is: $source_branch"
echo "TAG=PR-$pr_number-$source_branch-${{ env.buildid }}" >> $GITHUB_ENV
# Generate the tag for a pull request
echo "TAG=PR-$source_branch-${{ env.buildid }}" >> $GITHUB_ENV
echo "MAKE_LATEST=false" >> $GITHUB_ENV # Not marked as the latest cooker version if it's a feature branch
else else
# Generate the tag for non-pull request branches
TAG="$MANIFEST_VERSION-${{ env.buildid }}" TAG="$MANIFEST_VERSION-${{ env.buildid }}"
echo "TAG=$TAG" >> $GITHUB_ENV echo "TAG=$TAG" >> $GITHUB_ENV
echo "MAKE_LATEST=true" >> $GITHUB_ENV
fi fi
# Output the manifest version and generated tag for debugging
echo "MANIFEST_VERSION: $MANIFEST_VERSION" echo "MANIFEST_VERSION: $MANIFEST_VERSION"
echo "Version TAG: $TAG" echo "Version TAG: $TAG"
echo "MAKE_LATEST: $MAKE_LATEST"
# backing up manifest in case download fails and hashes must be recalculated # backing up manifest in case download fails and hashes must be recalculated
- name: Manifest backup - name: Manifest backup
@ -115,14 +138,6 @@ jobs:
- name: Build flatpak - name: Build flatpak
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_only.sh" run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_only.sh"
- name: Create Artifact for flathub
run: |
tar -czf ${GITHUB_WORKSPACE}/RetroDECK-Artifact-cooker.tar.gz -C ${GITHUB_WORKSPACE}/retrodeck-flatpak-cooker .
hash=($(sha256sum ${GITHUB_WORKSPACE}/RetroDECK-Artifact-cooker.tar.gz))
echo $hash > ${GITHUB_WORKSPACE}/RetroDECK-Artifact-cooker.sha
mv -f RetroDECK-Artifact-cooker.* ${{ secrets.ARTIFACT_REPO }}
continue-on-error: true
- name: Create Bundle - name: Create Bundle
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_bundle.sh" run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_bundle.sh"
@ -160,29 +175,41 @@ jobs:
artifacts: "RetroDECK-cooker.flatpak,RetroDECK-cooker.flatpak.sha,RetroDECK-Artifact.tar.gz" artifacts: "RetroDECK-cooker.flatpak,RetroDECK-cooker.flatpak.sha,RetroDECK-Artifact.tar.gz"
allowUpdates: true allowUpdates: true
makeLatest: ${{env.MAKE_LATEST}} # if it's a feat branch is not considered the latest build makeLatest: ${{env.MAKE_LATEST}} # if it's a feat branch is not considered the latest build
token: ${{ secrets.TRIGGER_BUILD_TOKEN }} token: ${{ steps.generate-rekku-token.outputs.token }}
repo: RetroDECK-cooker repo: Cooker
continue-on-error: true continue-on-error: true
- name: Rewrite Tag - name: Rewrite Tag
run: | run: |
git submodule deinit -f --all git submodule deinit -f --all
git fetch --tags git fetch --tags
git config --global user.name "Rekku"
git config --global user.email "rekku@retrodeck.net"
if git rev-parse --verify "${{ env.TAG }}" >/dev/null 2>&1; then # if the tag exists if git rev-parse --verify "${{ env.TAG }}" >/dev/null 2>&1; then # if the tag exists
git tag -d "${{ env.TAG }}" # remove it from local repo git tag -d "${{ env.TAG }}" # remove it from local repo
git push --delete origin "${{ env.TAG }}" # and from remote git push --delete origin "${{ env.TAG }}" # and from remote
fi fi
git tag "${{ env.TAG }}" # Create the tag locally git tag "${{ env.TAG }}" # Create the tag locally
git push origin "${{ env.TAG }}" # Push the new tag in the remote repo git push origin "${{ env.TAG }}" # Push the new tag in the remote repo
env:
GITHUB_TOKEN: ${{ steps.generate-rekku-token.outputs.token }}
# In case it cannot publish the release at least it's providing the flatpak file for creating a manual release # In case it cannot publish the release at least it's providing the flatpak file for creating a manual release
- name: Upload RetroDECK-cooker.flatpak - name: Upload RetroDECK-cooker.flatpak
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: retrodeck-flatpak name: retrodeck-flatpak
path: RetroDECK-cooker.flatpak path: RetroDECK-cooker.flatpak
continue-on-error: true continue-on-error: true
- name: Create Artifact for flathub
run: |
tar -czf ${GITHUB_WORKSPACE}/RetroDECK-Artifact-cooker.tar.gz -C ${GITHUB_WORKSPACE}/retrodeck-flatpak-cooker .
hash=($(sha256sum ${GITHUB_WORKSPACE}/RetroDECK-Artifact-cooker.tar.gz))
echo $hash > ${GITHUB_WORKSPACE}/RetroDECK-Artifact-cooker.sha
mv -f RetroDECK-Artifact-cooker.* ${{ secrets.ARTIFACT_REPO }}
continue-on-error: true
# - name: Upload RetroDECK-cooker.flatpak to Gitea Release # - name: Upload RetroDECK-cooker.flatpak to Gitea Release
# run: | # run: |
# # Set variables for Gitea host, organization, repository, access token, and release details # # Set variables for Gitea host, organization, repository, access token, and release details

View file

@ -7,8 +7,8 @@ on:
paths: paths:
- '.github/workflows/**' - '.github/workflows/**'
- 'automation_tools/**' - 'automation_tools/**'
- 'emu-configs/**' - 'config/**'
- 'es-configs/**' - 'config/es-de/**'
- 'functions/**' - 'functions/**'
- 'rd-submodules/**' - 'rd-submodules/**'
- '*.sh' - '*.sh'
@ -33,7 +33,7 @@ jobs:
continue-on-error: true continue-on-error: true
- name: Clone RetroDECK repo - name: Clone RetroDECK repo
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
submodules: 'true' submodules: 'true'
@ -128,7 +128,7 @@ jobs:
# In case it cannot publish the release at least it's providing the flatpak file for creating a manual release # In case it cannot publish the release at least it's providing the flatpak file for creating a manual release
- name: Upload RetroDECK.flatpak - name: Upload RetroDECK.flatpak
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: retrodeck-flatpak name: retrodeck-flatpak
path: RetroDECK.flatpak path: RetroDECK.flatpak

1
.gitignore vendored
View file

@ -22,6 +22,7 @@ retrodeck-repo
buildid buildid
*.bak *.bak
incconfigs/ incconfigs/
.github/workflows/cooker-monkeyx.yml
# Python # # Python #
########## ##########

9
.gitmodules vendored
View file

@ -1,9 +0,0 @@
[submodule "rd-submodules/shared-modules"]
path = rd-submodules/shared-modules
url = https://github.com/flathub/shared-modules.git
[submodule "rd-submodules/retroarch"]
path = rd-submodules/retroarch
url = https://github.com/flathub/org.libretro.RetroArch.git
[submodule "rd-submodules/ryujinx"]
path = rd-submodules/ryujinx
url = https://github.com/flathub/org.ryujinx.Ryujinx

View file

@ -1,15 +1,26 @@
# The proper format for this file is # The proper format for this file is
# ACTION^PLACEHOLDERTEXT^URL^REPO(Optional) # ACTION^PLACEHOLDERTEXT^URL^REPO(Optional)
# hash^DOOMSHAPLACEHOLDER^https://buildbot.libretro.com/assets/cores/DOOM/Doom%20%28Shareware%29.zip # hash^DOOMSHAPLACEHOLDER^https://buildbot.libretro.com/assets/cores/DOOM/Doom%20%28Shareware%29.zip
#hash^DUCKSTATIONSHAPLACEHOLDER^https://github.com/stenzek/duckstation/releases/download/preview/DuckStation-x64.AppImage # Please leave some newlines in the end of this file or it will break
latestcommit^UNIVERSALDYNAMICINPUTCOMMITPLACEHOLDER^https://github.com/Venomalia/UniversalDynamicInput^main
outside_file^VERSIONPLACEHOLDER^${GITHUB_WORKSPACE}/buildid
branch^THISBRANCH
THISREPO^THISREPO
hash^RASHAPLACEHOLDER^https://buildbot.libretro.com/nightly/linux/x86_64/RetroArch.7z
hash^SAMEDUCKSHAPLACEHOLDER^https://buildbot.libretro.com/nightly/linux/x86_64/latest/sameduck_libretro.so.zip hash^SAMEDUCKSHAPLACEHOLDER^https://buildbot.libretro.com/nightly/linux/x86_64/latest/sameduck_libretro.so.zip
hash^PPSSPPBIOSHASHPLACEHOLDER^https://github.com/hrydgard/ppsspp/archive/refs/heads/master.zip hash^PPSSPPBIOSHASHPLACEHOLDER^https://github.com/hrydgard/ppsspp/archive/refs/heads/master.zip
hash^MSXBIOSHASHPLACEHOLDER^http://bluemsx.msxblue.com/rel_download/blueMSXv282full.zip hash^MSXBIOSHASHPLACEHOLDER^http://bluemsx.msxblue.com/rel_download/blueMSXv282full.zip
hash^XEMUHDDHASHPLACEHOLDER^https://github.com/mborgerson/xemu-hdd-image/releases/latest/download/xbox_hdd.qcow2.zip 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^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^RANIGHTLYCORESPLACEHOLDER^https://buildbot.libretro.com/nightly/linux/x86_64/RetroArch_cores.7z
hash^RETRODECKMAMEPLACEHOLDER^"https://github.com/RetroDECK/MAME/releases/download/$(curl -s https://api.github.com/repos/RetroDECK/MAME/releases/latest | grep -oP '"tag_name": "\K(.*?)(?=")')/RetroDECK-MAME-Artifact.tar.gz"
url^RETRODECKMAMEURLPLACEHOLDER^"https://github.com/RetroDECK/MAME/releases/download/$(curl -s https://api.github.com/repos/RetroDECK/MAME/releases/latest | grep -oP '"tag_name": "\K(.*?)(?=")')/RetroDECK-MAME-Artifact.tar.gz" hash^RETRODECKESDELATEST^https://github.com/RetroDECK/ES-DE/releases/latest/download/RetroDECK-ES-DE-Artifact.tar.gz
latestcommit^UNIVERSALDYNAMICINPUTCOMMITPLACEHOLDER^https://github.com/Venomalia/UniversalDynamicInput^main hash^RETRODECKPPSSPPLATEST^https://github.com/RetroDECK/org.ppsspp.PPSSPP/releases/latest/download/RetroDECK-PPSSPP-Artifact.tar.gz
outside_file^VERSIONPLACEHOLDER^${GITHUB_WORKSPACE}/buildid hash^RETRODECKDOLPHINLATEST^https://github.com/RetroDECK/org.DolphinEmu.dolphin-emu/releases/latest/download/RetroDECK-dolphin-Artifact.tar.gz
branch^THISBRANCH hash^RETRODECKPRIMEHACKLATEST^https://github.com/RetroDECK/io.github.shiiion.primehack/releases/latest/download/RetroDECK-primehack-Artifact.tar.gz
hash^RETRODECKMELONDSLATEST^https://github.com/RetroDECK/net.kuribo64.melonDS/releases/latest/download/RetroDECK-melonds-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^RETRODECKMAMELATEST^https://github.com/RetroDECK/MAME/releases/latest/download/RetroDECK-MAME-Artifact.tar.gz

File diff suppressed because it is too large Load diff

View file

@ -1,46 +1,68 @@
#!/bin/bash #!/bin/bash
# Set script to exit immediately on any error
set -e
# 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. # 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 updates 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
# latestghtag: Finds the most recent tag on a GitHub repo, for repos that don't have normal releases, but also shouldn't use the latest commit # latestghtag: Finds the most recent tag on a GitHub repo, for repos that don't have normal releases, but also shouldn't use the latest commit
# Needs the URL of the repo, in this line format: latestghtag^PLACEHOLDERTEXT^url # Needs the URL of the repo, in this line format: latestghtag^PLACEHOLDERTEXT^url
# latestghrelease: Finds the download URL and SHA256 hash of the latest release from a git repo. # latestghrelease: Finds the download URL and SHA256 hash of the latest 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^<file suffix> # Needs the API URL of the repo, in this line format: latestghrelease^PLACEHOLDERTEXT^https://api.github.com/repos/<owner-name>/<repo-name>/releases/latest^<file suffix>
# 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 hash placeholder text is hardcoded in the script.
# The <file_suffix> will be the file extension or other identifying suffix at the end of the file name that can be used to select from multiple releases. # The <file_suffix> will be the file extension or other identifying suffix at the end of the file name that can be used to select from multiple releases.
# Example: If there are these file options for a given release: # Example: If there are these file options for a given release:
# yuzu-mainline-20240205-149629642.AppImage # yuzu-mainline-20240205-149629642.AppImage
# yuzu-linux-20240205-149629642-source.tar.xz # yuzu-linux-20240205-149629642-source.tar.xz
# yuzu-linux-20240205-149629642-debug.tar.xz # yuzu-linux-20240205-149629642-debug.tar.xz
# Entering "AppImage" (without quotes) for the <file_suffix> will identify yuzu-mainline-20240205-149629642.AppImage # Entering "AppImage" (without quotes) for the <file_suffix> will identify yuzu-mainline-20240205-149629642.AppImage
# Entering "source-.tar.xz" (without quotes) for the <file_suffix> will identify yuzu-linux-20240205-149629642-source.tar.xz # Entering "source-.tar.xz" (without quotes) for the <file_suffix> will identify yuzu-linux-20240205-149629642-source.tar.xz
# Entering "debug-tar.xz" (without quotes) for the <file_suffix> will identify yuzu-linux-20240205-149629642-debug.tar.xz # Entering "debug-tar.xz" (without quotes) for the <file_suffix> will identify yuzu-linux-20240205-149629642-debug.tar.xz
# As a file extension like ".tar.zx" can apply to multiple file options, the entire part that is appended to each release name should be included. # As a file extension like ".tar.xz" can apply to multiple file options, the entire part that is appended to each release name should be included.
# The <file_suffix> will also only consider entries where the given suffix is at the end of the file name. So "AppImage" will identify "file.AppImage" but not "file.AppImage.zsync" # The <file_suffix> will also only consider entries where the given suffix is at the end of the file name. So "AppImage" will identify "file.AppImage" but not "file.AppImage.zsync"
# latestghreleasesha: Finds the SHA256 hash of a specific asset in the latest release from a git repo.
# Needs the API URL of the repo, in this line format: latestghreleasesha^PLACEHOLDERTEXT^https://api.github.com/repos/<owner-name>/<repo-name>/releases/latest^<file suffix>
# This command updates the placeholder in the manifest with the SHA256 hash of the specified asset.
# 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_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. # 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. # 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 running 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 # 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. # url: This is used to calculate a dynamic URL and the value to the $calculated_url environmental variable, for use in other subsequent commands.
rd_manifest=${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml # Define paths
automation_task_list=${GITHUB_WORKSPACE}/automation_tools/automation_task_list.cfg rd_manifest="${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml"
current_branch=$(git rev-parse --abbrev-ref HEAD) automation_task_list="${GITHUB_WORKSPACE}/automation_tools/automation_task_list.cfg"
# During the PR automated tests instead of the branch name is returned "HEAD", fixing it # Retrieve current git branch
if [ $current_branch == "HEAD" ]; then get_current_branch() {
echo "Looks like we are on a PR environment, retrieving the branch name from which the PR is raised." local branch=$(git rev-parse --abbrev-ref HEAD)
current_branch=$(echo $GITHUB_REF | sed 's@refs/heads/@@') if [ "$branch" == "HEAD" ]; then
echo "The branch name from which the PR is raised is \"$current_branch\"." echo "$GITHUB_REF" | sed 's@refs/heads/@@'
fi else
echo "$branch"
fi
}
# Retrieve the repository URL
get_repo_url() {
local repo_url=$(git config --get remote.origin.url)
# Convert SSH URL to HTTPS if needed
if [[ "$repo_url" == git@* ]]; then
repo_url=$(echo "$repo_url" | sed -e 's|git@|https://|' -e 's|:|/|')
fi
echo "$repo_url"
}
current_branch=$(get_current_branch)
current_repo_url=$(get_repo_url)
echo "Manifest location: $rd_manifest" echo "Manifest location: $rd_manifest"
echo "Automation task list location: $automation_task_list" echo "Automation task list location: $automation_task_list"
@ -49,103 +71,139 @@ echo "Task list contents:"
cat "$automation_task_list" cat "$automation_task_list"
echo echo
# Update all collected information # Functions to handle different actions
while IFS="^" read -r action placeholder url branch || [[ -n "$action" ]]; handle_branch() {
do local placeholder="$1"
if [[ ! $action == "#"* ]] && [[ ! -z "$action" ]]; then echo "Replacing placeholder $placeholder with branch $current_branch"
/bin/sed -i 's^'"$placeholder"'^'"$current_branch"'^g' "$rd_manifest"
}
handle_hash() {
local placeholder="$1"
local url="$2"
local calculated_url=$(eval echo "$url")
local hash=$(curl -sL "$calculated_url" | sha256sum | cut -d ' ' -f1)
echo "Replacing placeholder $placeholder with hash $hash"
/bin/sed -i 's^'"$placeholder"'^'"$hash"'^g' "$rd_manifest"
}
handle_latestcommit() {
local placeholder="$1"
local url="$2"
local branch="$3"
local commit=$(git ls-remote "$url" "$branch" | cut -f1)
echo "Replacing placeholder $placeholder with latest commit $commit"
/bin/sed -i 's^'"$placeholder"'^'"$commit"'^g' "$rd_manifest"
}
handle_latestghtag() {
local placeholder="$1"
local url="$2"
local tag=$(git ls-remote --tags "$url" | tail -n 1 | cut -f2 | sed 's|refs/tags/||')
echo "Replacing placeholder $placeholder with latest tag $tag"
/bin/sed -i 's^'"$placeholder"'^'"$tag"'^g' "$rd_manifest"
}
handle_latestghrelease() {
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")
if [[ -z "$ghreleaseurl" ]]; then
echo "Error: No asset found with suffix $suffix"
exit 1
fi
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"
}
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")
if [[ -z "$ghreleaseurl" ]]; then
echo "Error: No asset found with suffix $suffix"
exit 1
fi
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"
}
handle_outside_file() {
local placeholder="$1"
local file_path="$2"
if [[ "$file_path" == \$* ]]; then
eval file_path="$file_path"
fi
local content=$(cat "$file_path")
echo "Replacing placeholder $placeholder with content of file $file_path"
/bin/sed -i 's^'"$placeholder"'^'"$content"'^g' "$rd_manifest"
}
handle_outside_env_var() {
local placeholder="$1"
local var_name="$2"
if [[ "$var_name" == \$* ]]; then
eval var_name="$var_name"
fi
local value=$(echo "$var_name")
echo "Replacing placeholder $placeholder with environment variable $value"
/bin/sed -i 's^'"$placeholder"'^'"$value"'^g' "$rd_manifest"
}
handle_custom_command() {
local command="$1"
echo "Executing custom command: $command"
eval "$command"
}
handle_url() {
local placeholder="$1"
local url="$2"
local calculated_url=$(eval echo "$url")
echo "Replacing placeholder $placeholder with calculated URL $calculated_url"
/bin/sed -i 's^'"$placeholder"'^'"$calculated_url"'^g' "$rd_manifest"
}
# Handle the THISREPO placeholder
handle_thisrepo() {
local placeholder="$1"
echo "Replacing placeholder $placeholder with repository URL $current_repo_url"
/bin/sed -i 's^'"$placeholder"'^'"$current_repo_url"'^g' "$rd_manifest"
}
# Process the task list
while IFS="^" read -r action placeholder url branch || [[ -n "$action" ]]; do
if [[ ! "$action" == "#"* ]] && [[ -n "$action" ]]; then
case "$action" in case "$action" in
"branch" ) handle_branch "$placeholder" ;;
"branch" ) "hash" ) handle_hash "$placeholder" "$url" ;;
echo "latestcommit" ) handle_latestcommit "$placeholder" "$url" "$branch" ;;
echo "Placeholder text: $placeholder" "latestghtag" ) handle_latestghtag "$placeholder" "$url" ;;
echo "Current branch:" "$current_branch" "latestghrelease" ) handle_latestghrelease "$placeholder" "$url" "$branch" ;;
echo "latestghreleasesha" ) handle_latestghreleasesha "$placeholder" "$url" "$branch" ;;
/bin/sed -i 's^'"$placeholder"'^'"$current_branch"'^g' $rd_manifest "outside_file" ) handle_outside_file "$placeholder" "$url" ;;
;; "outside_env_var" ) handle_outside_env_var "$placeholder" "$url" ;;
"custom_command" ) handle_custom_command "$url" ;;
"hash" ) "url" ) handle_url "$placeholder" "$url" ;;
echo "THISREPO" ) handle_thisrepo "$placeholder" ;;
echo "Placeholder text: $placeholder"
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 "$calculated_url" | sha256sum | cut -d ' ' -f1)
echo "Hash found: $hash"
/bin/sed -i 's^'"$placeholder"'^'"$hash"'^' $rd_manifest
;;
"latestcommit" )
echo
echo "Placeholder text: $placeholder"
echo "Repo to get latest commit from: $url branch: $branch"
echo
commit=$(git ls-remote "$url" "$branch" | cut -f1)
echo "Commit found: $commit"
/bin/sed -i 's^'"$placeholder"'^'"$commit"'^' $rd_manifest
;;
"latestghtag" )
echo
echo "Placeholder text: $placeholder"
echo "Repo to get the latest tag from: $url"
echo
tag=$(git ls-remote "$url" | tail -n 1 | cut -f2 | sed 's|refs/tags/||')
echo "Tag found: $tag"
/bin/sed -i 's^'"$placeholder"'^'"$tag"'^' $rd_manifest
;;
"latestghrelease" )
echo
echo "Placeholder text: $placeholder"
echo "Repo to look for latest releases: $url"
echo
ghreleaseurl=$(curl -s "$url" | grep browser_download_url | grep "$branch\""$ | cut -d : -f 2,3 | tr -d \" | sed -n 1p | tr -d ' ')
echo "GitHub release URL found: $ghreleaseurl"
/bin/sed -i 's^'"$placeholder"'^'"$ghreleaseurl"'^' $rd_manifest
ghreleasehash=$(curl -sL "$ghreleaseurl" | sha256sum | cut -d ' ' -f1)
echo "GitHub release hash found: $ghreleasehash"
/bin/sed -i 's^'"HASHFOR$placeholder"'^'"$ghreleasehash"'^' $rd_manifest
;;
"outside_file" )
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: $(cat $url)"
echo
/bin/sed -i 's^'"$placeholder"'^'"$(cat $url)"'^' $rd_manifest
;;
"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
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
;;
esac esac
fi fi
done < "$automation_task_list" done < "$automation_task_list"

View file

@ -153,13 +153,12 @@
<string name="ScreensaverType" value="video" /> <string name="ScreensaverType" value="video" />
<string name="StartupSystem" value="" /> <string name="StartupSystem" value="" />
<string name="SystemsSorting" value="manufacturer_hwtype_year" /> <string name="SystemsSorting" value="manufacturer_hwtype_year" />
<string name="Theme" value="art-book-next-es-de" /> <string name="Theme" value="retrodeck" />
<string name="ThemeAspectRatio" value="automatic" /> <string name="ThemeAspectRatio" value="automatic" />
<string name="ThemeColorScheme" value="art-book-next" /> <string name="ThemeColorScheme" value="retrodeck" />
<string name="ThemeFontSize" value="" /> <string name="ThemeFontSize" value="medium" />
<string name="ThemeSet" value="art-book-next-es-de" />
<string name="ThemeTransitions" value="automatic" /> <string name="ThemeTransitions" value="automatic" />
<string name="ThemeVariant" value="system-multi-gamelist-list-immersive" /> <string name="ThemeVariant" value="carousel" />
<string name="UIMode" value="full" /> <string name="UIMode" value="full" />
<string name="UIMode_passkey" value="uuddlrlrba" /> <string name="UIMode_passkey" value="uuddlrlrba" />
<string name="UserThemeDirectory" value="" /> <string name="UserThemeDirectory" value="" />

Some files were not shown because too many files have changed in this diff Show more