RetroDECK v0.9.0b (cooker merge + fixes)

This commit is contained in:
XargonWan 2025-01-31 09:30:57 +09:00
commit e94c495431
6040 changed files with 276446 additions and 11851 deletions

431
.github/workflows/build_retrodeck.yml vendored Normal file
View file

@ -0,0 +1,431 @@
name: "Build RetroDECK"
on:
push:
branches:
- main
- cooker*
- feat*
- branch/cooker*
paths:
- '.github/workflows/**'
- 'automation_tools/**'
- 'config/**'
- 'functions/**'
- 'rd-submodules/**'
- '*.sh'
- 'net.retrodeck.retrodeck.yml'
- 'net.retrodeck.retrodeck.metainfo.xml'
pull_request_target:
types: [opened, synchronize, reopened]
branches:
- main
- cooker*
- feat/*
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
- cooker*
- feat/*
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
# Build RetroDECK Job
Build_RetroDECK:
runs-on: retrodeck
outputs:
TAG: ${{ steps.version-tag.outputs.TAG }}
RELEASE_BODY: "${{ needs.Build_RetroDECK.outputs.RELEASE_BODY_FILE }} || No release body found"
MAKE_LATEST: ${{ steps.version-tag.outputs.MAKE_LATEST }}
steps:
# Remove Stuck Mounts
- name: Remove stuck mounts
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
# Clone Repository
- name: Clone RetroDECK repo
if: github.event_name != 'pull_request_target'
uses: actions/checkout@v4
with:
submodules: true
# Clone the target branch (eg. cooker)
- name: Clone Target Branch
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.ref }} # Branch target
submodules: true
# Because we're using pull_request_target, we need to merge the PR code
- name: Merge PR Code
if: github.event_name == 'pull_request_target'
run: |
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr
git merge --no-ff pr || {
echo "Merge conflict detected. Please resolve conflicts manually.";
exit 1;
}
# In case of PR we merged the code so we want to check that is consistent
- name: Validate Merged Code
if: github.event_name == 'pull_request_target'
run: |
echo "Branch after merge:"
git branch
echo "Last commit:"
git log -1 --oneline
# Install Dependencies
- name: Install dependencies
run: curl "https://raw.githubusercontent.com/RetroDECK/components-template/main/automation_tools/install_dependencies.sh" | bash
# Generate Build ID for Cooker Branches
- name: Generate cooker build ID
if: github.ref != 'refs/heads/main'
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/cooker_build_id.sh"
# Getting branch name, this needs as PR should be managed in a different way
- name: Get Branch Name
run: |
if [[ "$GITHUB_EVENT_NAME" == "pull_request" || "$GITHUB_EVENT_NAME" == "pull_request_target" ]]; then
branch_name="$GITHUB_HEAD_REF"
else
branch_name="$GITHUB_REF_NAME"
fi
echo "Branch name: $branch_name"
echo "BRANCH_NAME=$branch_name" >> $GITHUB_ENV
# Generates a version tag based on the event type (main branch, PR, or cooker) and sets it as output.
- name: Generate Version Tag
id: version-tag
run: |
# Source the version extractor script and fetch the manifest version
source automation_tools/version_extractor.sh
MANIFEST_VERSION="$(fetch_manifest_version)"
# Ensure the manifest version was successfully extracted
if [[ -z "$MANIFEST_VERSION" ]]; then
echo "[ERROR] Failed to extract the manifest version."
exit 1
fi
# Determine the tag based on the GitHub event context
if [[ "$GITHUB_REF" == "refs/heads/main" ]]; then
# Main branch tag
TAG="$MANIFEST_VERSION"
MAKE_LATEST=true
elif [[ "$GITHUB_EVENT_NAME" == "pull_request" || "$GITHUB_EVENT_NAME" == "pull_request_target" ]]; then
# Pull request tag, sanitize the source branch
source_branch="${GITHUB_HEAD_REF//\//-}"
TAG="PR-$source_branch-${{ github.run_id }}"
MAKE_LATEST=false
else
# Other branches (cooker branches)
TAG="$MANIFEST_VERSION-${{ env.BUILD_ID }}"
MAKE_LATEST=true
fi
echo "TAG=$TAG" >> $GITHUB_ENV
echo "MAKE_LATEST=$MAKE_LATEST" >> $GITHUB_ENV
echo "TAG=$TAG" >> $GITHUB_OUTPUT
echo "MAKE_LATEST=$MAKE_LATEST" >> $GITHUB_OUTPUT
# backing up manifest in case download fails and hashes must be recalculated
- name: Manifest backup
run: "cp ${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml ${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml.bak"
- name: Run pre-build automation tasks
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/manifest_placeholder_replacer.sh"
- name: "Adding flatpak portal for automated updates (Cooker only)"
if: github.ref != 'refs/heads/main'
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/cooker_flatpak_portal_add.sh"
# Temporary disabled as the script is broken
# - name: "Updating release notes in metainfo"
# run: "automation_tools/metainfo_management.sh"
- name: "[DEBUG] Outputting manifest"
run: cat net.retrodeck.retrodeck.yml
# Get Commits Since Last Published Release (Cooker only)
- name: Get commits since last published release
id: get-commits
if: github.ref != 'refs/heads/main'
run: |
# Get the latest published release tag
LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1) 2>/dev/null || echo "")
if [ -z "$LATEST_TAG" ]; then
echo "[INFO] No previous release found. Using all commits."
COMMITS=$(git log HEAD --pretty=format:"- %s")
else
echo "[INFO] Latest published release tag: $LATEST_TAG"
COMMITS=$(git log ${LATEST_TAG}..HEAD --pretty=format:"- %s")
fi
# Debug: Print the commits list
echo "Commits since $LATEST_TAG:"
echo "$COMMITS"
# Write the commits list to a file
echo "$COMMITS" > commits_list.txt
# Set the commits list as an environment variable
echo "COMMITS_FILE=commits_list.txt" >> $GITHUB_ENV
# - name: Extract XML Description
# uses: Mudlet/xmlstarlet-action@master
# id: extract-description
# with:
# args: sel -t -v "/component/releases/release[1]/description//text()" ./net.retrodeck.retrodeck.metainfo.xml
# Generate Release Body
- name: Generate release body text
id: generate-body
run: |
# Initialize the release body text
RELEASE_BODY_FILE="release_body.md"
echo "# Release Notes" > $RELEASE_BODY_FILE
echo "This is a cooker snapshot based on the commit: ${{ github.event.repository.full_name }}@${{ github.sha }}." >> $RELEASE_BODY_FILE
echo "On branch [${{ env.BRANCH_NAME }}](https://repo.retrodeck.net/RetroDECK/RetroDECK/src/branch/${{ env.BRANCH_NAME }})." >> $RELEASE_BODY_FILE
echo "## Commits since last release" >> $RELEASE_BODY_FILE
echo "" >> $RELEASE_BODY_FILE
# Append commits from the file to the release body
if [ -f "${{ env.COMMITS_FILE }}" ]; then
echo "${{ env.COMMITS_FILE }}" >> $RELEASE_BODY_FILE
echo "" >> $RELEASE_BODY_FILE
else
echo "[ERROR] Commits file not found: ${{ env.COMMITS_FILE }}"
echo "[ERROR] Commits file not found" >> $RELEASE_BODY_FILE
fi
# Debug: Print the release body so far
echo "[DEBUG] Current release body contents:"
cat $RELEASE_BODY_FILE
# Process raw description (if needed)
#raw_description="${{ steps.extract-description.outputs.result }}"
# Convert <p> tags to markdown headers using sed
# raw_description="${{ steps.extract-description.outputs.result }}"
markdown_description=$(echo "$raw_description" | sed -e 's|<p>|\n### |g' -e 's|</p>||g')
# Convert <li> tags to bullet points and trim spaces
markdown_description=$(echo "$markdown_description" | sed -e 's|<ul>||g' -e 's|</ul>||g' -e 's|<li>|- |g' -e 's|</li>||g' | awk '{$1=$1;print}')
# Remove any remaining XML tags
markdown_description=$(echo "$markdown_description" | sed -e 's/<[^>]*>//g')
# Debug: Print the markdown description
echo "Markdown Description:"
echo "$markdown_description"
# Append markdown content to the release body file
echo "$markdown_description" >> $RELEASE_BODY_FILE
# Output the file path to the environment and output variables
echo "RELEASE_BODY_FILE=$RELEASE_BODY_FILE" >> $GITHUB_ENV
echo "RELEASE_BODY_FILE=$RELEASE_BODY_FILE" >> $GITHUB_OUTPUT
echo "[DEBUG] CHECKPOINT 8"
- 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: "Build flatpak: download only"
id: flatpak-download
run: |
git config --global credential.helper store
echo "https://${{ steps.generate-rekku-token.outputs.token }}@github.com" > ~/.git-credentials
"${GITHUB_WORKSPACE}/automation_tools/flatpak_build_download_only.sh"
# Sometimes flatpak download fails, in this case it tries a second time
- name: "Build flatpak: download only (retry)"
if: steps.flatpak-download.outcome == 'failure'
run: |
git config --global credential.helper store
echo "https://${{ steps.generate-rekku-token.outputs.token }}@github.com" > ~/.git-credentials
echo "Download failed, maybe some hash changed since the build start."
echo "Recalculating hashes and retrying download..."
rm -f "{GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml"
cp "${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml.bak" "${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml"
"${GITHUB_WORKSPACE}/automation_tools/manifest_placeholder_replacer.sh"
"${GITHUB_WORKSPACE}/automation_tools/flatpak_build_download_only.sh"
- name: Build flatpak
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_only.sh"
- name: Create Bundle
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_bundle.sh"
# Upload artifacts for other jobs
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: retrodeck-artifacts
include-hidden-files: true
path: |
RetroDECK*.flatpak
RetroDECK*.flatpak.sha
RetroDECK*Artifact.tar.gz
GitHub-publish:
runs-on: ubuntu-latest
needs: Build_RetroDECK
env:
TAG: ${{ needs.Build_RetroDECK.outputs.TAG }}
RELEASE_BODY: "${{ needs.Build_RetroDECK.outputs.RELEASE_BODY_FILE }} || No release body found"
MAKE_LATEST: ${{ needs.Build_RetroDECK.outputs.MAKE_LATEST }}
steps:
- 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: Download all workflow run artifacts
uses: actions/download-artifact@v4.1.8
# Determine if Target Repository is Main or not, in that case is a Cooker build
- name: Determine target repository
id: set-repo
run: |
if [[ "$GITHUB_REF" == "refs/heads/main" ]]; then
echo "REPO_NAME=RetroDECK" >> $GITHUB_ENV
else
echo "REPO_NAME=Cooker" >> $GITHUB_ENV
fi
# Publish Release
- name: Publish release
uses: ncipollo/release-action@v1
with:
tag: ${{ env.TAG }}
name: "RetroDECK ${{ env.TAG }}"
body: ${{ env.RELEASE_BODY }}
artifacts: "retrodeck-artifacts/*.flatpak,retrodeck-artifacts/*.flatpak.sha,retrodeck-artifacts/*Artifact.tar.gz"
allowUpdates: true
makeLatest: ${{ env.MAKE_LATEST }}
repo: ${{ env.REPO_NAME }}
token: ${{ steps.generate-rekku-token.outputs.token }}
- name: Post PR comment with artifacts
if: github.event_name == 'pull_request_target' || github.event_name == 'pull_request'
uses: marocchino/sticky-pull-request-comment@v2
with:
GITHUB_TOKEN: ${{ steps.generate-rekku-token.outputs.token }}
header: "RetroDECK Build Artifacts"
message: |
A build for this pull request has completed successfully.
Codenname: ${{ env.TAG }}
Build artifacts can be find [here]((https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}#artifact-retrodeck-artifacts)) and they include:
- RetroDECK Flatpak: RetroDECK.flatpak
- Flatpak file SHA256 checksum: RetroDECK.flatpak.sha
- Flatpak Artifact Bundle: RetroDECKArtifact.tar.gz, not useful for testing or end users
# Rewrite Tag (for Main Branch Only)
- name: Rewrite Tag
if: github.ref == 'refs/heads/main'
run: |
git submodule deinit -f --all
git fetch --tags
if git rev-parse --verify "${{ env.TAG }}" >/dev/null 2>&1; then
git tag -d "${{ env.TAG }}"
git push --delete origin "${{ env.TAG }}"
fi
git tag "${{ env.TAG }}"
git push origin "${{ env.TAG }}"
env:
GITHUB_TOKEN: ${{ steps.generate-rekku-token.outputs.token }}
# As backup we're even publishing the build on our own selfhosted Fogejo instance
# Forgejo Publish Job if main branch
# Forgejo-publish:
# runs-on: ubuntu-latest
# needs: Build_RetroDECK
# env:
# TAG: ${{ needs.Build_RetroDECK.outputs.TAG }}
# RELEASE_BODY: "${{ needs.Build_RetroDECK.outputs.RELEASE_BODY_FILE }} || No release body found"
# MAKE_LATEST: ${{ needs.Build_RetroDECK.outputs.MAKE_LATEST }}
# steps:
#
# - name: Download all workflow run artifacts
# uses: actions/download-artifact@v4.1.8
#
# - name: Forgejo-publish
# if: github.ref == 'refs/heads/main'
# uses: RetroDECK/components-template/.github/workflows/fogejo_publish_release.yml@main
# with:
# release_body: "${{ needs.Build_RetroDECK.outputs.RELEASE_BODY_FILE }} || No release body found"
# artifacts: "retrodeck-artifacts/*.flatpak,retrodeck-artifacts/*.flatpak.sha,retrodeck-artifacts/*Artifact.tar.gz"
# tag: ${{ env.TAG }}
# Automated Tests
Automated_Tests:
runs-on: ubuntu-latest
needs: Build_RetroDECK
continue-on-error: true
steps:
# Clone Repository
- name: Clone RetroDECK repo
uses: actions/checkout@v4
with:
submodules: true
# Download RetroDECK Artifacts
- name: Download all workflow run artifacts
uses: actions/download-artifact@v4.1.8
# Install Dependencies
- name: Install dependencies
run: curl "https://raw.githubusercontent.com/RetroDECK/components-template/main/automation_tools/install_dependencies.sh" | bash
# Install RetroDECK Flatpak
- name: Install RetroDECK Flatpak
continue-on-error: true
run: |
ls -lah retrodeck-artifacts
flatpak install --user --bundle --noninteractive -y "retrodeck-artifacts/RetroDECK"*".flatpak
# Run Post Build Checks
- name: Run Post Build Checks
continue-on-error: true
run: /bin/bash ./automation_tools/post_build_check.sh
# Search for Missing Libraries
- name: Search for Missing Libraries
continue-on-error: true
run: /bin/bash ./automation_tools/search_missing_libs.sh
# Uninstall RetroDECK Flatpak - Not needed on a thorwaway ubuntu-latest
# - name: Uninstall RetroDECK Flatpak
# run: |
# flatpak remove --user --noninteractive -y net.retrodeck.retrodeck

View file

@ -1,240 +0,0 @@
name: "Build cooker"
on:
push:
branches:
- cooker*
- feat*
- branch/cooker*
paths:
- '.github/workflows/**'
- 'automation_tools/**'
- 'emu-configs/**'
- 'es-configs/**'
- 'functions/**'
- 'rd-submodules/**'
- '*.sh'
- 'net.retrodeck.retrodeck.yml'
- 'net.retrodeck.retrodeck.appdata.xml'
pull_request:
branches:
- cooker*
# Italy (CET): 11:00 PM
# Japan (JST): 7:00 AM
# schedule:
# - cron: '0 22 * * *'
workflow_dispatch:
jobs:
Building_RetroDECK:
runs-on: retrodeck
steps:
# Circumventing this bug: https://github.com/flatpak/flatpak-builder/issues/317
- name: Remove stuck mounts
run: sudo umount -f /home/ubuntu/retrodeck-runner/_work/RetroDECK/RetroDECK/.flatpak-builder/rofiles/*
continue-on-error: true
- name: Clone RetroDECK repo
uses: actions/checkout@v3
with:
submodules: 'true'
- name: "Install dependencies"
run: "automation_tools/install_dependencies.sh"
- name: Generate cooker build ID
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/cooker_build_id.sh"
- name: Get 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: |
if [[ "$BRANCH_NAME" == 'feat/'* || "$BRANCH_NAME" == 'refs/'* ]]; then
echo "MAKE_LATEST=false" >> $GITHUB_ENV
else
echo "MAKE_LATEST=true" >> $GITHUB_ENV
fi
# if the branch is coming from a PR the tag should be manually built
- name: "Generate version tag"
run: |
source automation_tools/version_extractor.sh
MANIFEST_VERSION="$(fetch_manifest_version)"
echo "MANIFEST_VERSION=$MANIFEST_VERSION" >> $GITHUB_ENV
if [[ "$BRANCH_NAME" == 'refs/'* ]]; then
pr_number=$(echo ${{env.BRANCH_NAME}} | awk -F'/' '{print $3}')
source_branch=$(curl -s "https://api.github.com/repos/XargonWan/RetroDECK/pulls/$pr_number" | jq -r '.head.ref')
source_branch=${source_branch//\//-}
echo "[DEBUG] source branch is: $source_branch"
echo "TAG=PR-$pr_number-$source_branch-${{ env.buildid }}" >> $GITHUB_ENV
else
TAG="$MANIFEST_VERSION-${{ env.buildid }}"
echo "TAG=$TAG" >> $GITHUB_ENV
fi
echo "MANIFEST_VERSION: $MANIFEST_VERSION"
echo "Version TAG: $TAG"
# backing up manifest in case download fails and hashes must be recalculated
- name: Manifest backup
run: "cp ${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml ${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml.bak"
- name: Run pre-build automation tasks
run : "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/pre_build_automation.sh"
- name: "Adding flatpak portal for automated updates (cooker only)"
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/cooker_flatpak_portal_add.sh"
- name: "Updating release notes in appdata"
run: "automation_tools/appdata_management.sh"
- name: "[DEBUG] Outputting manifest"
run: cat net.retrodeck.retrodeck.yml
- name: "Build flatpak: download only"
id: "flatpak-download"
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_download_only.sh"
continue-on-error: true
# Sometimes flatpak download fails, in this case it tries a second time
- name: "Build flatpak: download only (retry)"
if: steps.flatpak-download.outcome == 'failure'
run: |
echo "Download failed, maybe some hash changed since the build start."
echo "Recalculating hashes and retrying download..."
rm -f "{GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml"
cp "${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml.bak" "${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml"
"${GITHUB_WORKSPACE}/automation_tools/pre_build_automation.sh"
"${GITHUB_WORKSPACE}/automation_tools/flatpak_build_download_only.sh"
- name: Build flatpak
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
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_bundle.sh"
- name: Set environment variable with current branch name
run: echo "GITHUB_REF_SLUG=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
- name: Get commits since last release
run: |
# Get the latest release tag
LATEST_TAG=$(git describe --tags --abbrev=0)
# Get all commits since the latest release tag
COMMITS=$(git log $LATEST_TAG..HEAD --pretty=format:"- %s")
# Set the output variable
echo "::set-output name=commits::$COMMITS"
id: commits
continue-on-error: true
- name: Publish the flatpak in a new cooker release
uses: ncipollo/release-action@v1
with:
tag: "${{env.TAG}}"
body: |
# Release Notes (Cooker)
This is a cooker snapshot based on the commit: ${{ github.event.repository.full_name }}@${{github.sha}}.
On branch [${{env.BRANCH_NAME}}](https://github.com/XargonWan/RetroDECK/tree/${{env.BRANCH_NAME}}).
## Commits since last release
${{ steps.commits.outputs.commits }}
For the full release note for this build please refer to the channel [#BETA-TESTING](https://discord.gg/WDc5C9YWMx) on our Discord server.
Cooker channel is provided for the community to test fixes and explore new functionality.
Please DO NOT open issues or ask support on this build.
artifacts: "RetroDECK-cooker.flatpak,RetroDECK-cooker.flatpak.sha,RetroDECK-Artifact.tar.gz"
allowUpdates: true
makeLatest: ${{env.MAKE_LATEST}} # if it's a feat branch is not considered the latest build
token: ${{ secrets.TRIGGER_BUILD_TOKEN }}
repo: Cooker
continue-on-error: true
- name: Rewrite Tag
run: |
git submodule deinit -f --all
git fetch --tags
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 push --delete origin "${{ env.TAG }}" # and from remote
fi
git tag "${{ env.TAG }}" # Create the tag locally
git push origin "${{ env.TAG }}" # Push the new tag in the remote repo
# 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
uses: actions/upload-artifact@v3
with:
name: retrodeck-flatpak
path: RetroDECK-cooker.flatpak
continue-on-error: true
# - name: Upload RetroDECK-cooker.flatpak to Gitea Release
# run: |
# # Set variables for Gitea host, organization, repository, access token, and release details
# GITEA_HOST="repo.retrodeck.net"
# UPLOAD_HOST="upload.retrodeck.net"
# ORGANIZATION="RetroDECK"
# REPO="RetroDECK-cooker"
# GITEA_TOKEN="${{ secrets.GITEA_TRIGGER_BUILD_TOKEN }}"
# RELEASE_NAME="RetroDECK ${{env.TAG}}"
# TAG="${{env.TAG}}"
# RELEASE_BODY="# Release Notes (Cooker)
# This is a cooker snapshot based on the commit: ${{ github.event.repository.full_name }}@${{github.sha}}.
# On branch [${{env.BRANCH_NAME}}](https://repo.retrodeck.net/RetroDECK/RetroDECK/src/branch/${{env.BRANCH_NAME}}).
# ## Commits since last release
# ${{ steps.commits.outputs.commits }}
# For the full release note for this build please refer to the channel [#BETA-TESTING](https://discord.gg/WDc5C9YWMx) on our Discord server.
# Cooker channel is provided for the community to test fixes and explore new functionality.
# Please DO NOT open issues or ask support on this build."
# # Create a release using curl and capture the release ID
# release_response=$(curl -X POST \
# -H "Authorization: token ${GITEA_TOKEN}" \
# -H "Content-Type: application/json" \
# -d "{\"tag_name\":\"$TAG\",\"name\":\"$RELEASE_NAME\",\"body\":\"$RELEASE_BODY\"}" \
# "http://$GITEA_HOST/api/v1/repos/$ORGANIZATION/$REPO/releases")
# # Extract the release ID from the response
# release_id=$(echo $release_response | jq -r '.id')
# # Upload artifacts
# curl -X POST \
# -H "Authorization: token ${GITEA_TOKEN}" \
# -H "X-GitHub-Token: ${{ secrets.UPLOAD_TOKEN }}" \
# -H "Content-Type: multipart/form-data" \
# -F "attachment=@RetroDECK-cooker.flatpak" \
# "http://$UPLOAD_HOST/api/v1/repos/$ORGANIZATION/$REPO/releases/$release_id/assets?name=RetroDECK-cooker.flatpak"
# # Upload artifacts sha
# curl -X POST \
# -H "Authorization: token ${GITEA_TOKEN}" \
# -H "X-GitHub-Token: ${{ secrets.UPLOAD_TOKEN }}" \
# -H "Content-Type: multipart/form-data" \
# -F "attachment=@RetroDECK-cooker.flatpak.sha" \
# "http://$UPLOAD_HOST/api/v1/repos/$ORGANIZATION/$REPO/releases/$release_id/assets?name=RetroDECK-cooker.flatpak.sha"
# curl -X POST \
# -H "Authorization: token ${GITEA_TOKEN}" \
# -H "X-GitHub-Token: ${{ secrets.UPLOAD_TOKEN }}" \
# -H "Content-Type: multipart/form-data" \
# -F "attachment=@RetroDECK-Artifact.tar.gz" \
# "http://$UPLOAD_HOST/api/v1/repos/$ORGANIZATION/$REPO/releases/$release_id/assets?name=RetroDECK-Artifact.tar.gz"

View file

@ -84,7 +84,7 @@ jobs:
# curl -sL \
# -H "Accept: application/vnd.github+json" \
# -H "Authorization: Bearer ${{ secrets.TRIGGER_BUILD_TOKEN }}" \
# https://api.github.com/repos/XargonWan/RetroDECK-cooker/releases \
# https://api.github.com/repos/RetroDECK/Cooker/releases \
# | jq .[0].tag_name \
# | tr -d \" \
# )

View file

@ -1,191 +0,0 @@
name: "Build main"
on:
push:
branches:
- main
paths:
- '.github/workflows/**'
- 'automation_tools/**'
- 'emu-configs/**'
- 'es-configs/**'
- 'functions/**'
- 'rd-submodules/**'
- '*.sh'
- 'net.retrodeck.retrodeck.yml'
- 'net.retrodeck.retrodeck.appdata.xml'
pull_request:
branches:
- main
workflow_dispatch:
jobs:
Building_RetroDECK:
runs-on: retrodeck
steps:
# Circumventing this bug: https://github.com/flatpak/flatpak-builder/issues/317
- name: Remove stuck mounts
run: sudo umount -f /home/ubuntu/retrodeck-runner/_work/RetroDECK/RetroDECK/.flatpak-builder/rofiles/*
continue-on-error: true
- name: Clone RetroDECK repo
uses: actions/checkout@v3
with:
submodules: 'true'
- name: "Install dependencies"
run: "automation_tools/install_dependencies.sh"
# backing up manifest in case download fails and hashes must be recalculated
- name: Manifest backup
run: "cp ${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml ${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml.bak"
- name: Run pre-build automation tasks
run : "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/pre_build_automation.sh"
- name: Read manifest content
id: read_manifest
run: echo "::set-output name=file_content::$(cat net.retrodeck.retrodeck.yml)"
# - name: "Updating release notes in appdata"
# run: "automation_tools/appdata_management.sh"
- name: Check versions (main only)
id: check_version_string
run: "automation_tools/main_version_checker.sh"
- name: "[DEBUG] Outputting manifest"
run: cat net.retrodeck.retrodeck.yml
- name: "Build flatpak: download only"
id: "flatpak-download"
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_download_only.sh"
continue-on-error: true
# Sometimes flatpak download fails, in this case it tries a second time
- name: "Build flatpak: download only (retry)"
if: steps.flatpak-download.outcome == 'failure'
run: |
echo "Download failed, maybe some hash changed since the build start."
echo "Recalculating hashes and retrying download..."
rm -f "{GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml"
cp "${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml.bak" "${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml"
"${GITHUB_WORKSPACE}/automation_tools/pre_build_automation.sh"
"${GITHUB_WORKSPACE}/automation_tools/flatpak_build_download_only.sh"
- name: Build flatpak
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_only.sh"
- name: Create Artifact for flathub
run: |
tar -czf ${GITHUB_WORKSPACE}/RetroDECK-Artifact.tar.gz -C ${GITHUB_WORKSPACE}/retrodeck-flatpak-main .
hash=($(sha256sum ${GITHUB_WORKSPACE}/RetroDECK-Artifact.tar.gz))
echo $hash > ${GITHUB_WORKSPACE}/RetroDECK-Artifact.sha
mv -f RetroDECK-Artifact.* ${{ secrets.ARTIFACT_REPO }}
- name: Create Bundle
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_bundle.sh"
- name: Getting version info
id: version
run: |
appdata="https://raw.githubusercontent.com/XargonWan/RetroDECK/main/net.retrodeck.retrodeck.appdata.xml"
REL_VER=$(curl -s $appdata | xmlstarlet sel -t -v "//release/@version" | head -1)
DES="$(curl -s $appdata | xmlstarlet sel -t -m "//release[1]" -v "description" -n | sed '1,2d;$d;s/^ */- /;/^- $/d')"
echo "REL_VER=$REL_VER" >> $GITHUB_ENV
echo -e "# Release Notes\n" >> "body.md"
echo "$DES" >> "body.md"
- name: Publish the flatpak in a new release
uses: ncipollo/release-action@v1
env:
REL_VER: ${{ env.REL_VER }}
with:
tag: ${{ env.REL_VER }}
name: "RetroDECK v${{ env.REL_VER }}"
bodyFile: "body.md"
artifacts: "RetroDECK.flatpak,RetroDECK.flatpak.sha,RetroDECK-Artifact.tar.gz"
allowUpdates: true
makeLatest: true
token: ${{ secrets.TRIGGER_BUILD_TOKEN }}
repo: RetroDECK
continue-on-error: true
- name: Rewrite Tag
run: |
git submodule deinit -f --all
git fetch --tags
if git rev-parse --verify "${{ env.REL_VER }}" >/dev/null 2>&1; then # if the tag exists
git tag -d "${{ env.REL_VER }}" # remove it from local repo
git push --delete origin "${{ env.REL_VER }}" # and from remote
fi
git tag "${{ env.REL_VER }}" # Create the tag locally
git push origin "${{ env.REL_VER }}" # Push the new tag in the remote repo
# In case it cannot publish the release at least it's providing the flatpak file for creating a manual release
- name: Upload RetroDECK.flatpak
uses: actions/upload-artifact@v3
with:
name: retrodeck-flatpak
path: RetroDECK.flatpak
continue-on-error: true
- name: Publish release on Gitea
run: |
# Set variables for Gitea host, organization, repository, access token, and release details
GITEA_HOST="repo.retrodeck.net"
UPLOAD_HOST="upload.retrodeck.net"
ORGANIZATION="RetroDECK"
REPO="RetroDECK"
GITEA_TOKEN="${{ secrets.GITEA_TRIGGER_BUILD_TOKEN }}"
RELEASE_NAME="RetroDECK v${{ env.REL_VER }}"
TAG="${{ env.REL_VER }}"
payload=$(jq -cn \
--arg tag_name "$TAG" \
--arg name "$RELEASE_NAME" \
--arg body "$(cat body.md)" \
'{$tag_name, $name, $body}'
)
# Create a release using curl and capture the release ID
release_response=$(curl -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d "$payload" \
"http://$GITEA_HOST/api/v1/repos/$ORGANIZATION/$REPO/releases"
)
# Extract the release ID from the response
release_id=$(echo $release_response | jq -r '.id')
# Upload artifacts
curl -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "X-GitHub-Token: ${{ secrets.UPLOAD_TOKEN }}" \
-H "Content-Type: multipart/form-data" \
-F "attachment=@RetroDECK.flatpak" \
"http://$UPLOAD_HOST/api/v1/repos/$ORGANIZATION/$REPO/releases/$release_id/assets?name=RetroDECK-cooker.flatpak"
curl -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "X-GitHub-Token: ${{ secrets.UPLOAD_TOKEN }}" \
-H "Content-Type: multipart/form-data" \
-F "attachment=@RetroDECK-Artifact.tar.gz" \
"http://$UPLOAD_HOST/api/v1/repos/$ORGANIZATION/$REPO/releases/$release_id/assets?name=RetroDECK-Artifact.tar.gz"
continue-on-error: true # this will be in place until we reate an artifacts website that bypasses cloudflare limit
- name: Upload RetroDECK.flatpak.sha to Gitea Release
run: |
curl -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "X-GitHub-Token: ${{ secrets.UPLOAD_TOKEN }}" \
-F "file=@RetroDECK.flatpak.sha" \
"https://$UPLOAD_HOST/RetroDECK/RetroDECK/releases/${{ env.REL_VER }}/assets?name=RetroDECK.flatpak.sha"
env:
GITEA_TOKEN: ${{ secrets.GITEA_TRIGGER_BUILD_TOKEN }}
continue-on-error: true # this will be in place until we reate an artifacts website that bypasses cloudflare limit

10
.gitignore vendored
View file

@ -22,6 +22,16 @@ retrodeck-repo
buildid
*.bak
incconfigs/
*.flatpak
*.flatpak.sha
net.retrodeck.retrodeck.cached.yml
placeholders.cache
RetroDECK*Artifact.tar.gz
# Components artifacts #
############################
*.AppImage
ruffle-*.tar.gz
# 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,10 +1,10 @@
<p float="center">
<img src="https://github.com/XargonWan/RetroDECK/blob/main/res/logo.png?raw=true" alt="RetroDECK logo" width="600"/>
<img src="https://github.com/RetroDECK/RetroDECK/blob/main/res/logo.png?raw=true" alt="RetroDECK logo" width="600"/>
</p>
<p float="center">
<img src="https://github.com/XargonWan/RetroDECK/blob/main/res/screenshots/screen05.jpeg?raw=true" alt="screenshot" width="300"/>
<img src="https://github.com/XargonWan/RetroDECK/blob/main/res/screenshots/screen06.jpeg?raw=true" alt="screenshot" width="300"/>
<img src="https://github.com/RetroDECK/RetroDECK/blob/main/res/screenshots/screen05.jpeg?raw=true" alt="screenshot" width="300"/>
<img src="https://github.com/RetroDECK/RetroDECK/blob/main/res/screenshots/screen06.jpeg?raw=true" alt="screenshot" width="300"/>
</p>
Instead of having several different emulators, engines and frontends on your Linux/SteamOS system you only need one flatpak: RetroDECK.
@ -12,7 +12,7 @@ Instead of having several different emulators, engines and frontends on your Lin
![Flathub](https://img.shields.io/flathub/downloads/net.retrodeck.retrodeck)
![Flathub](https://img.shields.io/flathub/v/net.retrodeck.retrodeck)
![Discord](https://img.shields.io/discord/951662718102962256?label=discord)
![GitHub](https://img.shields.io/github/license/XargonWan/RetroDECK)
![GitHub](https://img.shields.io/github/license/RetroDECK/RetroDECK)
[![Documentation Status](https://readthedocs.org/projects/retrodeck/badge/?version=latest)](https://retrodeck.readthedocs.io/en/latest/?badge=latest)
# What is RetroDECK?
@ -38,11 +38,50 @@ For more information read here:
[Supported Systems](https://retrodeck.readthedocs.io/en/latest/wiki_general/supported-devices/)
## Is RetroDECK still Beta?
## What is RetroDECK?
RetroDECK is a [EmulationStation Desktop Edition](https://es-de.org) (ES-DE) powered Linux [Flatpak application](https://flathub.org/apps/net.retrodeck.retrodeck) that thanks to its `RetroDECK Framework` it builds-in and manage a variety of emulators and other software that allows you to play your favorite retro (and even not-so-retro) games in one complete package.
Yes, here you can read more about the beta period and our visions for a full release on the wiki:
### So what does that mean?
It means that RetroDECK provides all the emulators, systems and a frontend. RetroDECK configures them for you and puts them into one application you can download from Flathub.
[RetroDECK: Beta period](https://retrodeck.readthedocs.io/en/latest/wiki_general/beta-period/)
By being one application RetroDECK can put all important files in one location for all the emulators, instead of having them spread out over your entire system and even add features on top to orchestrate them seamlessly.
### The RetroDECK Framework
As previously mentioned, RetroDECK also adds the `RetroDECK Framework` on top of the emulators and ES-DE interface which allows deeper integrations between emulators and easier exposure to a variety of features that you otherwise need to set on a per emulator basis to create a uniformity between them.
The `RetroDECK Configurator` is a `Utility` that exposes some parts of the `RetroDECK Framework` to the RetroDECK users.
**What can the RetroDECK Framework and by extent the RetroDECK Configurator do?**
It can help with:
- Compressing games
- Easier `Texture Pack` and `Mod` management
- File management
- Tools for troubleshooting (BIOS Checker, Multi-File Structure Checker, Partial or full reset of functions)
- Auto installing some free BIOSes
- Install prebuilt Steam Input profiles for devices like the Steam Deck and external controllers
- Easier management of `mods`, `roms`, `texture_packs`, `scraped media`, `screenshots`, `saves / states` `gamelists` and more
- Give access to global presets that can be activated to configure things over many emulators in one go like: `RetroAchievements`
`Borders` `Widescreen Mode` `Swaping A/B X/Y for Nintendo Games`
For our long term vision you can check out the following wiki page:
[RetroDECK: Visions and Goals](https://retrodeck.readthedocs.io/en/latest/wiki_about/visions-and-goals/)
### How to get support?
Use the supports channels on [Discord](https://discord.gg/WDc5C9YWMx) `🤝-community-support` and `🆘-support`.
### The RetroDECK community:
[Website](https://retrodeck.net) <br/>
[Wiki](https://github.com/XargonWan/RetroDECK/wiki) <br/>
[Discord](https://discord.gg/WDc5C9YWMx)<br/>
[Lemmy](https://lemmy.zip/c/retrodeck)<br/>
[Subreddit](https://www.reddit.com/r/retrodeck)
### Is RetroDECK in Beta?
Yes, here you can read more about the beta period:
[RetroDECK: Beta period](https://retrodeck.readthedocs.io/en/latest/wiki_about/what-is-retrodeck/#retrodeck-is-currently-in-in-beta)
## How to get support and report issues?
@ -69,15 +108,26 @@ Yes, here you can read more about the beta period and our visions for a full rel
Yes, off course! Read up here:
[How-to: Contribute to RetroDECK](https://retrodeck.readthedocs.io/en/latest/wiki_community/contibute-rd/)
[How to: Contribute to RetroDECK](https://retrodeck.readthedocs.io/en/latest/wiki_community/contibute-rd/)
## Our repositories:
| Name | Description |
|-------------------------------------------------------------|-----------------------------------------------------------|
| [RetroDECK](https://github.com/XargonWan/RetroDECK) | This one, our main repo where the core of the project is |
| [RetroDECK-cooker](https://github.com/XargonWan/RetroDECK-cooker) | Where we publish our test build, no code is hosted here |
| [RetroDECK-Wiki](https://github.com/XargonWan/RetroDECK-Wiki) | Where our wiki source code is |
| [RetroDECK-website](https://github.com/XargonWan/RetroDECK-website) | Where our website source code is |
| [RetroDECK](https://github.com/RetroDECK/RetroDECK) | This one, our main repo where the core of the project is |
| [Cooker](https://github.com/RetroDECK/Cooker) | Where we publish our test build, no code is hosted here |
| [RetroDECK/Wiki](https://github.com/RetroDECK/Wiki) | Where our wiki source code is |
| [RetroDECK-website](https://github.com/RetroDECK/RetroDECK-website) | Where our website source code is |
| [RetroDECK on Flathub](https://github.com/flathub/net.retrodeck.retrodeck) | Our little space in Flathub's organization |
| [RetroDECK-MAME](https://github.com/XargonWan/RetroDECK-MAME) | MAME is big to build, so it's pre-built here and then imported in the build |
| [RetroDECK-ES-DE](https://github.com/XargonWan/RetroDECK-ES-DE) | This is where we store our patched fork of ES-DE |
# The RetroDECK Wiki
Please check out the [Wiki](https://github.com/XargonWan/RetroDECK/wiki) for even more information.
## The FAQ
The RetroDECK [FAQ](https://github.com/XargonWan/RetroDECK/wiki/FAQs%3A-Frequently-asked-questions) on the wiki has a vast variety of questions and answers.
# How to get support?
Use the supports channels on [Discord](https://discord.gg/WDc5C9YWMx).

View file

@ -1,15 +1,30 @@
# The proper format for this file is
# ACTION^PLACEHOLDERTEXT^URL^REPO(Optional)
# 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^RANIGHTLYSHAPLACEHOLDER^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^PPSSPPBIOSHASHPLACEHOLDER^https://github.com/hrydgard/ppsspp/archive/refs/heads/master.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^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^"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"
latestcommit^UNIVERSALDYNAMICINPUTCOMMITPLACEHOLDER^https://github.com/Venomalia/UniversalDynamicInput^main
outside_file^VERSIONPLACEHOLDER^${GITHUB_WORKSPACE}/buildid
branch^THISBRANCH
hash^RETRODECKESDELATEST^https://github.com/RetroDECK/ES-DE/releases/latest/download/RetroDECK-ES-DE-Artifact.tar.gz
hash^RETRODECKPPSSPPLATEST^https://github.com/RetroDECK/org.ppsspp.PPSSPP/releases/latest/download/RetroDECK-Artifact.tar.gz
hash^RETRODECKDOLPHINLATEST^https://github.com/RetroDECK/org.DolphinEmu.dolphin-emu/releases/latest/download/RetroDECK-Artifact.tar.gz
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-Artifact.tar.gz
hash^RETRODECKMAMELATEST^https://github.com/RetroDECK/org.mamedev.MAME/releases/latest/download/RetroDECK-Artifact.tar.gz
hash^PORTMASTERLATESTSHA^https://github.com/PortsMaster/PortMaster-GUI/releases/latest/download/retrodeck.portmaster.zip
hash^RACITRAPLACEHOLDER^https://buildbot.libretro.com/nightly/linux/x86_64/latest/citra_libretro.so.zip
hash^RETRODECKRPCS3LATEST^https://github.com/RetroDECK/net.rpcs3.RPCS3/releases/latest/download/RetroDECK-Artifact.tar.gz
hash^RETRODECKLATESTVITA3KSHA^https://github.com/RetroDECK/Vita3K-bin/releases/latest/download/ubuntu-latest.zip

File diff suppressed because it is too large Load diff

View file

@ -6,5 +6,5 @@ word2=$(shuf -n 1 ${GITHUB_WORKSPACE}/automation_tools/codename_wordlist.txt)
capitalized_word2="$(tr '[:lower:]' '[:upper:]' <<< ${word2:0:1})${word2:1}"
result=$capitalized_word1$capitalized_word2
echo $result > ${GITHUB_WORKSPACE}/buildid
echo "buildid=$result" >> $GITHUB_ENV
echo "BUILD_ID=$result" >> $GITHUB_ENV
echo "VersionID is $result"

View file

@ -15,10 +15,20 @@ fi
mkdir -vp ${GITHUB_WORKSPACE}/retrodeck-repo
mkdir -vp ${GITHUB_WORKSPACE}/"$FOLDER"
flatpak-builder --user --force-clean \
# Pass the args to Flatpak Builder
FLATPAK_BUILD_EXTRA_ARGS="${@}"
echo "Passing additional args to flatpak builder: $FLATPAK_BUILD_EXTRA_ARGS"
command="flatpak-builder --user --force-clean $FLATPAK_BUILD_EXTRA_ARGS \
--install-deps-from=flathub \
--install-deps-from=flathub-beta \
--repo=${GITHUB_WORKSPACE}/retrodeck-repo \
--disable-download \
"${GITHUB_WORKSPACE}/$FOLDER" \
net.retrodeck.retrodeck.yml
--disable-download $FLATPAK_BUILDER_CCACHE\
\"${GITHUB_WORKSPACE}/$FOLDER\" \
net.retrodeck.retrodeck.yml"
# Echo the command for verification
echo -e "Executing command:\n$command"
# Execute the command
eval $command

View file

@ -1,31 +0,0 @@
#!/bin/bash
# This script is installing the required dependencies to correctly run the pipeline and build the flatpak
unset pkg_mgr
# rpm-ostree must be checked before dnf because a dnf (wrapper) command also works on rpm-ostree distros (not what we want)
for potential_pkg_mgr in apt pacman rpm-ostree dnf; do
command -v "$potential_pkg_mgr" &> /dev/null && pkg_mgr="$potential_pkg_mgr" && break
done
case "$pkg_mgr" in
apt)
sudo apt install -y flatpak flatpak-builder p7zip-full xmlstarlet bzip2 curl jq
;;
pacman)
sudo pacman -S --noconfirm flatpak flatpak-builder p7zip xmlstarlet bzip2
;;
rpm-ostree)
echo "When using a distro with rpm-ostree, you shouldn't build directly on the host. Try using a distrobox."
exit 1
;;
dnf)
sudo dnf install -y flatpak flatpak-builder p7zip p7zip-plugins xmlstarlet bzip2 curl
;;
*)
echo "Package manager $pkg_mgr not supported. Please open an issue."
;;
esac
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak remote-add --user --if-not-exists flathub-beta https://flathub.org/beta-repo/flathub-beta.flatpakrepo

179
automation_tools/libman.sh Normal file
View file

@ -0,0 +1,179 @@
#!/bin/bash
# Be aware that this script deletes the source directory after copying the files. It is intended to be used only by the flatpak builder.
# List of user-defined libraries to exclude
excluded_libraries=()
# General libraries
excluded_libraries=("libselinux.so.1" "libwayland-egl.so.1" "libwayland-cursor.so.0" "libxkbcommon.so.0")
# Qt libraries
excluded_libraries+=("libQt6Multimedia.so.6" "libQt6Core.so.6" "libQt6DBus.so.6" "libQt6Gui.so.6" "libQt6OpenGL.so.6" "libQt6Svg.so.6" "libQt6WaylandClient.so.6" "libQt6WaylandEglClientHwIntegration.so.6" "libQt6Widgets.so.6" "libQt6XcbQpa.so.6")
# SDL libraries
excluded_libraries+=("libSDL2_net-2.0.so.0.200.0" "libSDL2_mixer-2.0.so.0.600.3" "libSDL2-2.0.so.0" "libSDL2_mixer-2.0.so.0" "libSDL2_image-2.0.so.0" "libSDL2-2.0.so.0.2800.5" "libSDL2_ttf-2.0.so.0" "libSDL2_net-2.0.so.0" "libSDL2_image-2.0.so.0.600.3" "libSDL2_ttf-2.0.so.0.2200.0")
# FFMPEG libraries
excluded_libraries+=("libavcodec.so" "libavformat.so" "libavutil.so" "libavfilter.so" "libavdevice" "libswresample.so" "libswscale.so")
# Add libraries from /lib/x86_64-linux-gnu/ to the excluded list
for lib in /lib/x86_64-linux-gnu/*.so*; do
excluded_libraries+=("$(basename "$lib")")
done
# Add libraries from /lib to the excluded list
for lib in /lib/*.so*; do
excluded_libraries+=("$(basename "$lib")")
done
# Add libraries from /lib64 to the excluded list
for lib in /lib64/*.so*; do
excluded_libraries+=("$(basename "$lib")")
done
# Define target directory
target_dir="${FLATPAK_DEST}/lib"
# Define debug directory
debug_dir="${target_dir}/debug"
echo "Worry not, LibMan is here!"
# Set default destination if FLATPAK_DEST is not set
if [ -z "$FLATPAK_DEST" ]; then
export FLATPAK_DEST="/app"
fi
# Check if source directory is provided
if [ -z "$1" ]; then
echo "Usage: $0 <source_directory>"
exit 0
fi
# Ensure the target directory exists
if ! mkdir -p "$target_dir"; then
echo "Error: Failed to create target directory $target_dir"
exit 0
fi
# Ensure the debug directory exists
if ! mkdir -p "$debug_dir"; then
echo "Error: Failed to create debug directory $debug_dir"
exit 0
fi
# Function to check if a file is in the excluded libraries list
is_excluded() {
local file="$1"
for excluded in "${excluded_libraries[@]}"; do
if [[ "$file" == $excluded ]]; then # NOTE excluded is not quoted to allow for wildcard matching
return 0
fi
done
return 1
}
# Find and copy files
copied_files=()
failed_files=()
# First, copy all regular files
for file in $(find "$1" -type f -name "*.so*" ! -type l); do
# Check if the file is in the debug folder
if [[ "$file" == *"/debug/"* ]]; then
dest_file="$debug_dir/$(basename "$file")"
else
dest_file="$target_dir/$(basename "$file")"
fi
# Skip if the file is in the list of excluded libraries
if is_excluded "$(basename "$file")"; then
reason="library is in the exclusion list"
echo "Skipped $file as it is $reason"
failed_files+=("$file, $reason")
continue
fi
# Skip if the destination file already exists
if [ -e "$dest_file" ]; then
echo "Skipped $file as $dest_file already exists"
continue
fi
# Attempt to copy the file
if install -D "$file" "$dest_file" 2>error_log; then
echo "Copied $file to $dest_file"
copied_files+=("$file")
else
error_message=$(<error_log)
echo "Warning: Failed to copy $file. Skipping. Error: $error_message"
failed_files+=("$file, $error_message")
fi
done
# Then, copy all symlinks
for file in $(find "$1" -type l -name "*.so*"); do
# Check if the file is in the debug folder
if [[ "$file" == *"/debug/"* ]]; then
dest_file="$debug_dir/$(basename "$file")"
else
dest_file="$target_dir/$(basename "$file")"
fi
# Get the target of the symlink
symlink_target=$(readlink "$file")
# Define the destination for the symlink target
if [[ "$symlink_target" == *"/debug/"* ]]; then
dest_symlink_target="$debug_dir/$(basename "$symlink_target")"
else
dest_symlink_target="$target_dir/$(basename "$symlink_target")"
fi
# Copy the symlink target if it doesn't already exist
if [ ! -e "$dest_symlink_target" ]; then
if install -D "$symlink_target" "$dest_symlink_target" 2>error_log; then
echo "Copied symlink target $symlink_target to $dest_symlink_target"
copied_files+=("$symlink_target")
else
error_message=$(<error_log)
echo "Warning: Failed to copy symlink target $symlink_target. Skipping. Error: $error_message"
failed_files+=("$symlink_target, $error_message")
continue
fi
fi
# Create the symlink in the target directory
if ln -s "$dest_symlink_target" "$dest_file" 2>error_log; then
echo "Created symlink $dest_file -> $dest_symlink_target"
copied_files+=("$file")
else
error_message=$(<error_log)
echo "Warning: Failed to create symlink $dest_file. Skipping. Error: $error_message"
failed_files+=("$file, $error_message")
fi
done
# Output the lists of copied and failed files
if [ ${#copied_files[@]} -ne 0 ]; then
echo "Imported libraries:"
for file in "${copied_files[@]}"; do
echo "$file"
done
fi
# Output failed files only if the list is not empty
if [ ${#failed_files[@]} -ne 0 ]; then
echo "Failed library files:"
for file in "${failed_files[@]}"; do
echo "$file"
done
fi
# Remove excluded libraries from the target directory
for excluded in "${excluded_libraries[@]}"; do
if [ -e "$target_dir/$excluded" ]; then
rm -f "$target_dir/$excluded"
echo "Deleted excluded library $target_dir/$excluded"
fi
done
echo "LibMan is flying away"

View file

@ -5,27 +5,27 @@
source automation_tools/version_extractor.sh
# Set the file paths
appdata="net.retrodeck.retrodeck.appdata.xml"
metainfo="net.retrodeck.retrodeck.metainfo.xml"
manifest="net.retrodeck.retrodeck.yml"
manifest_content=$(cat "$manifest")
compare_versions() {
local manifest_version_cleaned=$(echo "$1" | sed 's/[a-zA-Z]//g')
local appdata_version_cleaned=$(echo "$2" | sed 's/[a-zA-Z]//g')
local metainfo_version_cleaned=$(echo "$2" | sed 's/[a-zA-Z]//g')
if [[ "$manifest_version_cleaned" == "$appdata_version_cleaned" ]]; then
if [[ "$manifest_version_cleaned" == "$metainfo_version_cleaned" ]]; then
return 0 # Versions are equal
fi
local IFS=.
local manifest_parts=($manifest_version_cleaned)
local appdata_parts=($appdata_version_cleaned)
local metainfo_parts=($metainfo_version_cleaned)
for ((i=0; i<${#manifest_parts[@]}; i++)); do
if ((manifest_parts[i] > appdata_parts[i])); then
if ((manifest_parts[i] > metainfo_parts[i])); then
return 1 # Manifest version is greater
elif ((manifest_parts[i] < appdata_parts[i])); then
return 2 # Appdata version is greater
elif ((manifest_parts[i] < metainfo_parts[i])); then
return 2 # Metainfo version is greater
fi
done
@ -38,8 +38,8 @@ echo -e "Online repository:\t$repo_version"
manifest_version=$(fetch_manifest_version)
echo -e "Manifest:\t\t$manifest_version"
appdata_version=$(fetch_appdata_version)
echo -e "Appdata:\t\t$appdata_version"
metainfo_version=$(fetch_metainfo_version)
echo -e "Metainfo:\t\t$metainfo_version"
# Additional checks
if [[ "$manifest_version" == "main" || "$manifest_version" == "THISBRANCH" || "$manifest_version" == *"cooker"* ]]; then
@ -47,8 +47,8 @@ if [[ "$manifest_version" == "main" || "$manifest_version" == "THISBRANCH" || "$
exit 1
fi
if [[ "$appdata_version" != "$manifest_version" ]]; then
echo "Appdata version is not equal to manifest version. Please fix it."
if [[ "$metainfo_version" != "$manifest_version" ]]; then
echo "Metainfo version is not equal to manifest version. Please fix it."
exit 1
fi

View file

@ -0,0 +1,239 @@
#!/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:
# sh automation_tools/manifest_placeholder_replacer.sh
# 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.
# Needs the URL of the file, in this line format: hash^PLACEHOLDERTEXT^url
# 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
# 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
# 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: 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,
# 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 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.
# Example: If there are these file options for a given release:
# yuzu-mainline-20240205-149629642.AppImage
# yuzu-linux-20240205-149629642-source.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 "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
# 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"
# 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_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 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
# url: This is used to calculate a dynamic URL and the value to the $calculated_url environmental variable, for use in other subsequent commands.
# Define paths
rd_manifest="${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml"
automation_task_list="${GITHUB_WORKSPACE}/automation_tools/automation_task_list.cfg"
cache_file="${GITHUB_WORKSPACE}/placeholders.cache"
# Check if cache file exists
if [ -f "$cache_file" ]; then
echo "Warning: Cache file $cache_file is being used. If you encounter issues with hashes, consider deleting this file."
fi
# Retrieve current git branch
get_current_branch() {
local branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$branch" == "HEAD" ]; then
echo "$GITHUB_REF" | sed 's@refs/heads/@@'
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 "Automation task list location: $automation_task_list"
echo
echo "Task list contents:"
cat "$automation_task_list"
echo
# Function to get hash from cache or calculate it
get_hash() {
local url="$1"
local hash
# Check if cache should be used and if cache file exists
# the use_cache variable is initialized by build_retrodeck_locally only so in the pipeline it will never use cache
if [ "$use_cache" == "true" ] && [ -f "$cache_file" ]; then
# Try to retrieve hash from cache
hash=$(grep "^$url " "$cache_file" | cut -d ' ' -f2)
fi
# If hash is not found in cache, calculate it
if [ -z "$hash" ]; then
hash=$(curl -sL "$url" | sha256sum | cut -d ' ' -f1)
# Save the calculated hash to cache if caching is enabled
if [ "$use_cache" == "true" ]; then
echo "$url $hash" >> "$cache_file"
fi
fi
# Return the hash
echo "$hash"
}
# Functions to handle different actions
handle_branch() {
local placeholder="$1"
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=$(get_hash "$calculated_url")
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=$(get_hash "$ghreleaseurl")
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=$(get_hash "$ghreleaseurl")
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
"branch" ) handle_branch "$placeholder" ;;
"hash" ) handle_hash "$placeholder" "$url" ;;
"latestcommit" ) handle_latestcommit "$placeholder" "$url" "$branch" ;;
"latestghtag" ) handle_latestghtag "$placeholder" "$url" ;;
"latestghrelease" ) handle_latestghrelease "$placeholder" "$url" "$branch" ;;
"latestghreleasesha" ) handle_latestghreleasesha "$placeholder" "$url" "$branch" ;;
"outside_file" ) handle_outside_file "$placeholder" "$url" ;;
"outside_env_var" ) handle_outside_env_var "$placeholder" "$url" ;;
"custom_command" ) handle_custom_command "$url" ;;
"url" ) handle_url "$placeholder" "$url" ;;
"THISREPO" ) handle_thisrepo "$placeholder" ;;
esac
fi
done < "$automation_task_list"

View file

@ -1,47 +1,48 @@
#!/bin/bash
# THIS SCRIPT IS BROKEN HENCE DISABLED FTM
# This script is getting the latest release notes from the wiki and add them to the appdata
# This script is getting the latest release notes from the wiki and add them to the metainfo
source automation_tools/version_extractor.sh
# Fetch appdata version
appdata_version=$(fetch_appdata_version)
log i "Appdata:\t\t$appdata_version"
# Fetch metainfo version
metainfo_version=$(fetch_metainfo_version)
echo -e "metainfo:\t\t$metainfo_version"
# Defining manifest file location
appdata_file="net.retrodeck.retrodeck.appdata.xml"
metainfo_file="net.retrodeck.retrodeck.metainfo.xml"
# Check if release with appdata_version already exists
if grep -q "version=\"$appdata_version\"" "$appdata_file"; then
log i "Deleting existing release version $appdata_version..."
# Check if release with metainfo_version already exists
if grep -q "version=\"$metainfo_version\"" "$metainfo_file"; then
echo -e "Deleting existing release version $metainfo_version..."
# Remove the existing release entry
sed -i "/<release version=\"$appdata_version\"/,/<\/release>/d" "$appdata_file"
sed -i "/<release version=\"$metainfo_version\"/,/<\/release>/d" "$metainfo_file"
fi
log i "Adding new release version $appdata_version..."
echo -e "Adding new release version $metainfo_version..."
# Get today's date in the required format (YYYY-MM-DD)
today_date=$(date +"%Y-%m-%d")
log i "Today is $today_date"
echo -e "Today is $today_date"
# Construct the release snippet
release_snippet="\
<releases>
<release version=\"$appdata_version\" date=\"$today_date\">
<url>https://github.com/XargonWan/RetroDECK/releases/tag/$appdata_version</url>
<release version=\"$metainfo_version\" date=\"$today_date\">
<url>https://github.com/RetroDECK/RetroDECK/releases/tag/$metainfo_version</url>
<description>
RELEASE_NOTES_PLACEHOLDER
</description>
</release>"
# Read the entire content of the XML file
xml_content=$(cat "$appdata_file")
xml_content=$(cat "$metainfo_file")
# Replace RELEASE_NOTES_PLACEHOLDER with the actual release notes
# TODO
git clone https://github.com/XargonWan/RetroDECK.wiki.git /tmp/wiki
rm -rf /tmp/wiki
git clone https://github.com/RetroDECK/RetroDECK.wiki.git /tmp/wiki
# Path to the markdown file
wiki="/tmp/wiki/Version-history:-Patch-Notes.md"
@ -88,7 +89,7 @@ release_description="${release_snippet/RELEASE_NOTES_PLACEHOLDER/$section_list}"
modified_xml_content="${xml_content/<releases>/$release_description}"
# Overwrite the original XML file with the modified content
echo "$modified_xml_content" > "$appdata_file"
echo "$modified_xml_content" > "$metainfo_file"
# Format the XML file
#xmlstarlet fo --omit-decl "$appdata_file"
#xmlstarlet fo --omit-decl "$metainfo_file"

View file

@ -0,0 +1,93 @@
#!/bin/bash
# This script runs entirely inside the Flatpak sandbox for net.retrodeck.retrodeck
# Flatpak App ID
FLATPAK_APP_ID="net.retrodeck.retrodeck"
# Log file inside the Flatpak sandbox
LOG_FILE="$HOME/retrodeck-post-build-check.log"
# Clear previous log
> "$LOG_FILE"
# Ensure global.sh is sourced inside the Flatpak sandbox
GLOBAL_SH_PATH="/app/libexec/global.sh"
# Check if the global.sh script exists
if ! flatpak run --command=ls "$FLATPAK_APP_ID" "$GLOBAL_SH_PATH" &> /dev/null; then
echo "✗ global.sh not found at $GLOBAL_SH_PATH" | tee -a "$LOG_FILE"
exit 1
fi
# Source global.sh to load the `features` variable
echo "Sourcing $GLOBAL_SH_PATH to load features" | tee -a "$LOG_FILE"
features=$(flatpak run --command=bash "$FLATPAK_APP_ID" -c "source $GLOBAL_SH_PATH && echo \$features")
# Ensure `features` variable is set
if [ -z "$features" ]; then
echo "✗ Failed to load features from $GLOBAL_SH_PATH" | tee -a "$LOG_FILE"
exit 1
fi
# Extract launch commands using jq
echo "Extracting launch commands from $features" | tee -a "$LOG_FILE"
commands=($(flatpak run --command=jq "$FLATPAK_APP_ID" -r '.emulator | to_entries[] | .value.launch' "$features"))
echo "Extracted launch commands: ${commands[@]}" | tee -a "$LOG_FILE"
# Timeout duration in seconds
TIMEOUT=3
# Function to run command with timeout
run_and_check() {
local cmd="$1"
echo "Validating command: \"$cmd\"" | tee -a "$LOG_FILE"
# Verify command exists within the Flatpak sandbox
if ! flatpak run --command=which "$FLATPAK_APP_ID" "$cmd" &> /dev/null; then
echo "✗ Command not found: $cmd (Exit Code: 127)" | tee -a "$LOG_FILE"
return 127
fi
# Run command with timeout inside the sandbox
flatpak run --command=timeout "$FLATPAK_APP_ID" -s TERM $TIMEOUT "$cmd" &> /dev/null &
local pid=$!
sleep $TIMEOUT
# Ensure the process is terminated
if kill -0 $pid 2>/dev/null; then
#echo "✗ $cmd did not terminate, killing process" | tee -a "$LOG_FILE"
kill -9 $pid
fi
local exit_code=$?
# Log the results
echo "Command: $cmd, Exit Code: $exit_code" | tee -a "$LOG_FILE"
case $exit_code in
0)
echo "$cmd completed successfully" | tee -a "$LOG_FILE"
;;
124)
echo "$cmd terminated after $TIMEOUT seconds" | tee -a "$LOG_FILE"
;;
137)
echo "$cmd killed after timeout" | tee -a "$LOG_FILE"
;;
*)
echo "$cmd failed" | tee -a "$LOG_FILE"
;;
esac
return $exit_code
}
# Execute commands inside the Flatpak sandbox
for cmd in "${commands[@]}"; do
run_and_check "$cmd"
done
echo "$LOG_FILE"
grep "✗" "$LOG_FILE"

View file

@ -1,151 +0,0 @@
#!/bin/bash
# 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
# 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.
# 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.
# 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
# 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.
# 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>
# 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 "HASH" prefix of the 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.
# Example: If there are these file options for a given release:
# yuzu-mainline-20240205-149629642.AppImage
# yuzu-linux-20240205-149629642-source.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 "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
# 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.
# 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"
# 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
automation_task_list=${GITHUB_WORKSPACE}/automation_tools/automation_task_list.cfg
current_branch=$(git rev-parse --abbrev-ref HEAD)
# During the PR automated tests instead of the branch name is returned "HEAD", fixing it
if [ $current_branch == "HEAD" ]; then
echo "Looks like we are on a PR environment, retrieving the branch name from which the PR is raised."
current_branch=$(echo $GITHUB_REF | sed 's@refs/heads/@@')
echo "The branch name from which the PR is raised is \"$current_branch\"."
fi
echo "Manifest location: $rd_manifest"
echo "Automation task list location: $automation_task_list"
echo
echo "Task list contents:"
cat "$automation_task_list"
echo
# Update all collected information
while IFS="^" read -r action placeholder url branch || [[ -n "$action" ]];
do
if [[ ! $action == "#"* ]] && [[ ! -z "$action" ]]; then
case "$action" in
"branch" )
echo
echo "Placeholder text: $placeholder"
echo "Current branch:" "$current_branch"
echo
/bin/sed -i 's^'"$placeholder"'^'"$current_branch"'^g' $rd_manifest
;;
"hash" )
echo
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
fi
done < "$automation_task_list"

View file

@ -0,0 +1,14 @@
#!/bin/bash
# Search for missing libraries
missing_libs=$(flatpak run --command=sh net.retrodeck.retrodeck -c \
"find /app/bin -type f -exec ldd {} + 2>/dev/null | grep 'not found' | awk '{print \$2}' | tr -d ':' | xargs -n 1 basename | sort | uniq | tr '\n' ' '")
# If there is any missing library, it will be printed, and the step will fail
if [ -n "$missing_libs" ]; then
echo "The following libraries are missing:"
echo "$missing_libs"
exit 1
else
echo "TEST OK: No missing libraries are found"
fi

View file

@ -0,0 +1,86 @@
#!/bin/bash
# Path to the configuration file
CONFIG_FILE="config/retrodeck/reference_lists/features.json"
# Check if file exists
if [ ! -f "$CONFIG_FILE" ]; then
echo "Error: $CONFIG_FILE not found"
exit 1
fi
# Get today's date in the format YYYY-MM-DD
TODAYS_DATE=$(date +%Y-%m-%d)
# Update dates using jq
jq '
def is_leap_year($year): ($year % 4 == 0 and $year % 100 != 0) or ($year % 400 == 0);
def increment_date($date):
if $date | length == 4 then
($date[0:2] | tonumber) as $month |
($date[2:4] | tonumber) as $day |
if $month == 12 and $day == 31 then
"0101"
elif $month == 2 and $day == 28 and is_leap_year(2024) then
"0229"
elif $month == 2 and ($day == 28 or $day == 29) then
"0301"
elif $day == 30 and ($month == 4 or $month == 6 or $month == 9 or $month == 11) then
(if ($month + 1) < 10 then "0" else "" end + (($month + 1) | tostring)) + "01"
elif $day == 31 then
(if ($month + 1) < 10 then "0" else "" end + (($month + 1) | tostring)) + "01"
else
(if $month < 10 then "0" else "" end + ($month | tostring)) +
(if ($day + 1) < 10 then "0" else "" end + (($day + 1) | tostring))
end
elif $date | length == 10 then
($date[0:4] | tonumber) as $year |
($date[5:7] | tonumber) as $month |
($date[8:10] | tonumber) as $day |
if $month == 12 and $day == 31 then
(($year + 1) | tostring) + "-01-01"
elif $month == 2 and $day == 28 and is_leap_year($year + 1) then
(($year + 1) | tostring) + "-02-29"
elif $month == 2 and ($day == 28 or $day == 29) then
(($year + 1) | tostring) + "-03-01"
elif $day == 30 and ($month == 4 or $month == 6 or $month == 9 or $month == 11) then
(($year + 1) | tostring) + "-" +
(if ($month + 1) < 10 then "0" else "" end + (($month + 1) | tostring)) + "-01"
elif $day == 31 then
(($year + 1) | tostring) + "-" +
(if ($month + 1) < 10 then "0" else "" end + (($month + 1) | tostring)) + "-01"
else
(($year + 1) | tostring) + "-" +
(if $month < 10 then "0" else "" end + ($month | tostring)) + "-" +
(if ($day + 1) < 10 then "0" else "" end + (($day + 1) | tostring))
end
else .
end;
.splash_screens |= with_entries(
.value |= (
if has("start_date") then
if .start_date < "'$TODAYS_DATE'" then
.start_date = increment_date(.start_date)
else . end
else . end |
if has("end_date") then
if .end_date < "'$TODAYS_DATE'" then
.end_date = increment_date(.end_date)
else . end
else . end |
if has("full_start_date") then
if .full_start_date < "'$TODAYS_DATE'" then
.full_start_date = increment_date(.full_start_date)
else . end
else . end |
if has("full_end_date") then
if .full_end_date < "'$TODAYS_DATE'" then
.full_end_date = increment_date(.full_end_date)
else . end
else . end
)
)' "$CONFIG_FILE" > "${CONFIG_FILE}.tmp" && mv "${CONFIG_FILE}.tmp" "$CONFIG_FILE"
echo "All applicable dates rolled forward by one day."

View file

@ -2,27 +2,27 @@
# This script is intended to gather version information from various sources:
# RetroDECK repository
# Appdata.xml file
# Metainfo.xml file
# Manifest YAML file
# It consists of three functions, each responsible for retrieving a specific version-related data.
appdata="net.retrodeck.retrodeck.appdata.xml"
metainfo="net.retrodeck.retrodeck.metainfo.xml"
manifest="net.retrodeck.retrodeck.yml"
manifest_content=$(cat "$manifest")
fetch_repo_version(){
# Getting latest RetroDECK release info
LATEST_RELEASE=$(curl -s "https://api.github.com/repos/XargonWan/RetroDECK/releases/latest")
LATEST_RELEASE=$(curl -s "https://api.github.com/repos/RetroDECK/RetroDECK/releases/latest")
# Extracting tag name from the latest release
repo_version=$(echo "$LATEST_RELEASE" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
# Printing results
echo "$repo_version"
}
fetch_appdata_version(){
# Extract the version from the net.retrodeck.retrodeck.appdata.xml file
appdata_version=$(grep -oPm1 "(?<=<release version=\")[^\"]+" "$appdata")
echo "$appdata_version"
fetch_metainfo_version(){
# Extract the version from the net.retrodeck.retrodeck.metainfo.xml file
metainfo_version=$(grep -oPm1 "(?<=<release version=\")[^\"]+" "$metainfo")
echo "$metainfo_version"
}
fetch_manifest_version(){

View file

@ -54,7 +54,7 @@
<GameCache/>
<GraphicPack/>
<Graphic>
<api>1</api>
<api>0</api>
<device>00000000000000000000000000000000</device>
<VSync>0</VSync>
<GX2DrawdoneSync>true</GX2DrawdoneSync>

View file

@ -18,7 +18,7 @@ Lock Camera in Motion Puzzles = True
ReduceBloom = True
ToggleArmRePosition = True
[Settings]
AspectRatio = 1
AspectRatio = 0
BackendMultithreading = True
DumpBaseTextures = True
DumpMipTextures = True

View file

@ -42,7 +42,7 @@ FastmemMode = true
[GPU]
Renderer = Vulkan
Renderer = OpenGL
Adapter = AMD RADV VANGOGH
ResolutionScale = 3
Multisamples = 1
@ -412,12 +412,25 @@ Type = None
[Hotkeys]
FastForward = Keyboard/Tab
TogglePause = Keyboard/Space
Screenshot = Keyboard/F10
ToggleFullscreen = Keyboard/F11
OpenPauseMenu = Keyboard/Escape
LoadSelectedSaveState = Keyboard/F1
SaveSelectedSaveState = Keyboard/F2
SelectPreviousSaveStateSlot = Keyboard/F3
SelectNextSaveStateSlot = Keyboard/F4
ToggleTurbo = Keyboard/Control & Keyboard/T
ToggleFullscreen = Keyboard/Control & Keyboard/Return
TogglePause = Keyboard/Control & Keyboard/P
Screenshot = Keyboard/Control & Keyboard/X
Reset = Keyboard/Control & Keyboard/R
ChangeDisc = Keyboard/Control & Keyboard/D
Rewind = Keyboard/Control & Keyboard/Minus
ToggleCheats = Keyboard/Control & Keyboard/C
IncreaseEmulationSpeed = Keyboard/Control & Keyboard/1
DecreaseEmulationSpeed = Keyboard/Control & Keyboard/2
ResetEmulationSpeed = Keyboard/Control & Keyboard/3
IncreaseResolutionScale = Keyboard/Control & Keyboard/U
DecreaseResolutionScale = Keyboard/Control & Keyboard/Y
ToggleWidescreen = Keyboard/Control & Keyboard/W
LoadSelectedSaveState = Keyboard/Control & Keyboard/A
SaveSelectedSaveState = Keyboard/Control & Keyboard/S
SelectPreviousSaveStateSlot = Keyboard/Control & Keyboard/J
SelectNextSaveStateSlot = Keyboard/Control & Keyboard/K
PowerOff = Keyboard/Control & Keyboard/Q
UndoLoadState = Keyboard/Control & Keyboard/9
OpenPauseMenu = Keyboard/Control & Keyboard/M
ToggleFastForward = Keyboard/Control & Keyboard/Plus

View file

@ -118,7 +118,7 @@
<string name="ApplicationUpdaterFrequency" value="never" />
<string name="ApplicationUpdaterLastCheck" value="20230331T153206" />
<string name="CollectionCustomGrouping" value="unthemed" />
<string name="CollectionSystemsAuto" value="recent" />
<string name="CollectionSystemsAuto" value="favorites,recent" />
<string name="CollectionSystemsCustom" value="" />
<string name="DefaultSortOrder" value="name, ascending" />
<string name="GamelistViewStyle" value="automatic" />
@ -146,20 +146,19 @@
<string name="Scraper" value="screenscraper" />
<string name="ScraperLanguage" value="en" />
<string name="ScraperPasswordScreenScraper" value="" />
<string name="ScraperRegion" value="eu" />
<string name="ScraperRegion" value="wor" />
<string name="ScraperUsernameScreenScraper" value="" />
<string name="ScreensaverSlideshowCustomDir" value="" />
<string name="ScreensaverSlideshowImageDir" value="/var/config/ES-DE/slideshow/custom_images" />
<string name="ScreensaverType" value="video" />
<string name="StartupSystem" value="" />
<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="ThemeColorScheme" value="art-book-next" />
<string name="ThemeFontSize" value="" />
<string name="ThemeSet" value="art-book-next-es-de" />
<string name="ThemeColorScheme" value="retrodeck" />
<string name="ThemeFontSize" value="medium" />
<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_passkey" value="uuddlrlrba" />
<string name="UserThemeDirectory" value="" />

View file

@ -1,6 +1,7 @@
#!/bin/bash
source /app/libexec/logger.sh
# Source the global.sh script if not already sourced
if [ -z "${GLOBAL_SOURCED+x}" ]; then
source /app/libexec/global.sh
fi
# Define the IWAD files list
IWAD_FILES=("DOOM1.WAD" "DOOM.WAD" "DOOM2.WAD" "DOOM2F.WAD" "DOOM64.WAD" "TNT.WAD"
@ -15,7 +16,9 @@ is_iwad() {
local file="$1"
local lowercase_file="$(basename "${file,,}")"
# Loop through the list of IWAD files
for iwad in "${IWAD_FILES[@]}"; do
# Check if the lowercase version of the IWAD file matches the input file
if [[ "${iwad,,}" == "$lowercase_file" ]]; then
echo "true"
return
@ -42,7 +45,17 @@ search_file_recursive() {
}
# Main script
log "[INFO] RetroDECK GZDOOM wrapper init"
log d "RetroDECK GZDOOM wrapper init"
# Check if the filename contains a single quote
if [[ "$1" == *"'"* ]]; then
log e "Invalid filename: \"$1\" contains a single quote.\nPlease rename the file in a proper way before continuing."
rd_zenity --error --no-wrap \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK" \
--text="<span foreground='$purple'><b>Invalid filename\n\n</b></span>\"$1\" contains a single quote.\nPlease rename the file in a proper way before continuing."
exit 1
fi
# Check if $1 is not a .doom file
if [[ "${1##*.}" != "doom" ]]; then
@ -57,7 +70,7 @@ if [[ "${1##*.}" != "doom" ]]; then
log i "Loading: \"$1\""
log i "Executing command \"$command\""
# Execute the command
# Execute the command with double quotes
eval "$command"
# Check if $1 is a .doom file
@ -79,6 +92,16 @@ else
command="gzdoom -config /var/config/gzdoom/gzdoom.ini"
while IFS= read -r line; do
# Check if the line contains a single quote
if [[ "$line" == *"'"* ]]; then
log e "Invalid filename: A file containined in \"$1\" contains a single quote"
rd_zenity --error --no-wrap \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK" \
--text="<span foreground='$purple'><b>Invalid filename\n\n</b></span>A file containined in \"$1\" contains a single quote.\nPlease rename the file and fix its name in the .doom file."
exit 1
fi
# Search for the file recursively
found_file=$(search_file_recursive "$line" "$(dirname "$doom_file")")
@ -105,6 +128,6 @@ else
# Log the command
log i "Executing command \"$command\""
# Execute the command
# Execute the command with double quotes
eval "$command"
fi

View file

@ -0,0 +1,9 @@
{
"change_channel": false,
"first-run": true,
"release_channel": "stable",
"show_experimental": false,
"theme": "default_theme",
"theme-scheme": "Dracula",
"version": 2
}

View file

@ -16,7 +16,7 @@ Lock Camera in Motion Puzzles = True
ReduceBloom = True
ToggleArmRePosition = True
[Settings]
AspectRatio = 1
AspectRatio = 0
BackendMultithreading = True
DumpBaseTextures = True
DumpMipTextures = True

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