feat(automation): added the AppImage build job

This commit is contained in:
XargonWan 2025-04-04 11:25:32 +09:00
parent b2ecbb3d05
commit 5707fc135b
2 changed files with 152 additions and 74 deletions

View file

@ -3,110 +3,99 @@ name: "Build ES-DE"
on:
push:
branches:
- retrodeck-main
- main
- feat/*
- retrodeck-main
- main
- feat/*
workflow_dispatch:
jobs:
Set_Release_Metadata:
runs-on: ubuntu-latest
outputs:
branch_name: ${{ steps.set-vars.outputs.branch_name }}
date: ${{ steps.set-vars.outputs.date }}
steps:
- name: Set Branch and Date
id: set-vars
run: |
BRANCH_NAME=$(echo "${GITHUB_REF#refs/heads/}")
DATE=$(date +'%d%m%y.%S')
echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
echo "date=$DATE" >> $GITHUB_OUTPUT
Building_RetroDECK-ES-DE:
runs-on: ubuntu-latest
needs: Set_Release_Metadata
steps:
- name: Clone repo
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'recursive'
token: ${{ secrets.TRIGGER_BUILD_TOKEN }}
fetch-depth: 1
# Install Dependencies
- name: Install dependencies
run: curl "https://raw.githubusercontent.com/RetroDECK/components-template/main/automation_tools/install_dependencies.sh" | bash
- name: Run pre-build automation tasks
run : "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/pre_build_automation.sh"
- name: Pre-build automation
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/pre_build_automation.sh"
- name: "[DEBUG] Outputting manifest"
run: cat net.retrodeck.es-de.yml
- name: "Build flatpak"
id: "flatpak-download"
- name: Build flatpak
run: |
git config --global protocol.file.allow always
flatpak-builder --user --force-clean \
--install-deps-from=flathub \
--install-deps-from=flathub-beta \
--repo=${GITHUB_WORKSPACE}/es-de-repo \
"${GITHUB_WORKSPACE}"/es-de-build-dir \
"${GITHUB_WORKSPACE}/es-de-build-dir" \
net.retrodeck.es-de.yml
- name: "Exporting dir tree"
id: tree
run: tree -H ./ > ${GITHUB_WORKSPACE}/tree.html
- name: Package flatpak artifact
run: |
tar -czf RetroDECK-ES-DE-Artifact.tar.gz -C es-de-build-dir .
tree -H ./ > tree.html
- name: Create Artifact for RetroDECK
run: |
tar -czf ${GITHUB_WORKSPACE}/RetroDECK-ES-DE-Artifact.tar.gz -C ${GITHUB_WORKSPACE}/es-de-build-dir .
hash=($(sha256sum ${GITHUB_WORKSPACE}/RetroDECK-ES-DE-Artifact.tar.gz))
echo $hash > ${GITHUB_WORKSPACE}/RetroDECK-Artifact-cooker.sha
mv -f RetroDECK-Artifact-cooker.* ${{ secrets.ARTIFACT_REPO }}
continue-on-error: true
timeout-minutes: 1440
- name: Set environment variable with current branch name
run: echo "GITHUB_REF_SLUG=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
- name: Get branch name
id: branch_name
run: echo "BRANCH_NAME=$(echo $GITHUB_REF | sed 's|refs/heads/||')" >> $GITHUB_ENV
- name: Get date
id: date
run: echo "DATE=$(date +'%d%m%y.%S')" >> $GITHUB_ENV
- name: Publish the artifacts in a release
- name: Upload flatpak to GitHub Release
uses: ncipollo/release-action@v1
with:
tag: "${{env.BRANCH_NAME}}-${{env.DATE}}"
tag: "${{ needs.Set_Release_Metadata.outputs.branch_name }}-${{ needs.Set_Release_Metadata.outputs.date }}"
name: "${{ needs.Set_Release_Metadata.outputs.branch_name }} Build"
body: |
# Release Notes
These are the artifact of RetroDECK ES-DE, commit: ${{ github.event.repository.full_name }}@${{github.sha}}.
On branch [${{env.BRANCH_NAME}}](https://github.com/RetroDECK/ES-DE/tree/${{env.BRANCH_NAME}}).
artifacts: "RetroDECK-ES-DE-Artifact.tar.gz, tree.html"
Build of RetroDECK ES-DE from `${{ github.repository }}@${{ github.sha }}`
- Branch: [${{ needs.Set_Release_Metadata.outputs.branch_name }}](https://github.com/${{ github.repository }}/tree/${{ needs.Set_Release_Metadata.outputs.branch_name }})
artifacts: |
RetroDECK-ES-DE-Artifact.tar.gz
tree.html
allowUpdates: true
makeLatest: ${{ contains(env.BRANCH_NAME, 'feat/') && 'false' || 'true' }}
makeLatest: ${{ contains(needs.Set_Release_Metadata.outputs.branch_name, 'feat/') && 'false' || 'true' }}
token: ${{ secrets.TRIGGER_BUILD_TOKEN }}
continue-on-error: true
# - name: Clone Cooker repo
# if: contains(env.BRANCH_NAME, 'feat/') == false
# uses: actions/checkout@v3
# with:
# repository: RetroDECK/RetroDECK
# #ref: cooker
# ref: feat/lighter-manifest # TODO: put cooker when this is merged
# submodules: 'recursive'
# token: ${{ secrets.TRIGGER_BUILD_TOKEN }}
# path: cooker
Create_AppImage_RetroDECK:
runs-on: ubuntu-latest
needs: Set_Release_Metadata
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'recursive'
token: ${{ secrets.TRIGGER_BUILD_TOKEN }}
fetch-depth: 1
# - name: "Update RetroDECK Cooker manifest with new artifact URL and SHA256"
# if: contains(env.BRANCH_NAME, 'feat/') == false
# run: |
# NEW_URL="https://github.com/RetroDECK/ES-DE/releases/download/${{env.BRANCH_NAME}}-${{env.DATE}}/RetroDECK-ES-DE-Artifact.tar.gz"
# NEW_SHA256=$(cat ${GITHUB_WORKSPACE}/RetroDECK-Artifact-cooker.sha)
# yq e -i '.modules[] | select(.name == "ES-DE") | .sources[0].url = strenv(NEW_URL)' cooker/net.retrodeck.retrodeck.yml
# yq e -i '.modules[] | select(.name == "ES-DE") | .sources[0].sha256 = strenv(NEW_SHA256)' cooker/net.retrodeck.retrodeck.yml
# - name: Commit and push changes to Cooker repo
# if: contains(env.BRANCH_NAME, 'feat/') == false
# run: |
# cd "${GITHUB_WORKSPACE}/cooker"
# git config user.name "GitHub Actions"
# git config user.email "actions@github.com"
# git add net.retrodeck.retrodeck.yml
# git commit -m "ES-DE: updated module with new artifact URL and SHA256 [skip ci]"
# git push origin HEAD
- name: Build AppImage
run: |
chmod +x tools/create_AppImage_RetroDECK.sh
./tools/create_AppImage_RetroDECK.sh
- name: Upload AppImage to GitHub Release
uses: ncipollo/release-action@v1
with:
tag: "${{ needs.Set_Release_Metadata.outputs.branch_name }}-${{ needs.Set_Release_Metadata.outputs.date }}"
name: "${{ needs.Set_Release_Metadata.outputs.branch_name }} Build"
body: |
AppImage build for RetroDECK.
Branch: [${{ needs.Set_Release_Metadata.outputs.branch_name }}](https://github.com/${{ github.repository }}/tree/${{ needs.Set_Release_Metadata.outputs.branch_name }})
artifacts: |
RetroDECK-AppImage.tar.gz
allowUpdates: true
makeLatest: ${{ contains(needs.Set_Release_Metadata.outputs.branch_name, 'feat/') && 'false' || 'true' }}
token: ${{ secrets.TRIGGER_BUILD_TOKEN }}

View file

@ -0,0 +1,89 @@
#!/usr/bin/bash
# SPDX-License-Identifier: MIT
#
# ES-DE Frontend
# create_AppImage_SteamDeck.sh
#
# Runs the complete process of building a Linux AppImage specific to the Valve Steam Deck.
# The SDL library is also built and included in the AppImage.
#
# This script has only been tested on Ubuntu 20.04 LTS and 22.04 LTS.
#
# How many CPU threads to use for the compilation.
JOBS=4
SDL_RELEASE_TAG=release-2.32.2
SDL_SHARED_LIBRARY=libSDL2-2.0.so.0.3200.2
echo "Building Steam Deck AppImage..."
if [ ! -f .clang-format ]; then
echo "You need to run this script from the root of the repository."
exit
fi
if [ ! -f appimagetool-x86_64.AppImage ]; then
echo -e "Can't find appimagetool-x86_64.AppImage, downloading the latest version...\n"
wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
fi
chmod a+x appimagetool-x86_64.AppImage
if [ ! -f linuxdeploy-x86_64.AppImage ]; then
echo -e "Can't find linuxdeploy-x86_64.AppImage, downloading the latest version...\n"
wget "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
fi
chmod a+x linuxdeploy-x86_64.AppImage
if [ ! -f external/SDL/build/${SDL_SHARED_LIBRARY} ]; then
echo
echo "Building the SDL library..."
cd external
rm -rf SDL
git clone https://github.com/libsdl-org/SDL.git
cd SDL
git checkout $SDL_RELEASE_TAG
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -S .. -B .
if [ $(grep PKG_PIPEWIRE_VERSION:INTERNAL= CMakeCache.txt) = "PKG_PIPEWIRE_VERSION:INTERNAL=" ]; then
echo
echo -e "The SDL library is not configured with PipeWire support, aborting."
exit
fi
make -j${JOBS}
cd ../../..
else
echo
echo -e "The SDL library has already been built, skipping this step\n"
fi
rm -rf ./AppDir
mkdir AppDir
rm -f CMakeCache.txt
cmake -DAPPIMAGE_BUILD=on -DRETRODECK=on .
make clean
make -j${JOBS}
make install DESTDIR=AppDir
cd AppDir
ln -s usr/bin/es-de AppRun
ln -s usr/share/pixmaps/es-de.svg .
ln -s usr/share/applications/org.es_de.frontend.desktop .
ln -s es-de.svg .DirIcon
cd usr/bin
ln -s ../share/es-de/resources .
ln -s ../share/es-de/themes .
cd ../../..
./linuxdeploy-x86_64.AppImage -l /lib/x86_64-linux-gnu/libOpenGL.so.0 -l /lib/x86_64-linux-gnu/libGLdispatch.so.0 -l /lib/x86_64-linux-gnu/libgio-2.0.so.0 --appdir AppDir
cp external/SDL/build/${SDL_SHARED_LIBRARY} AppDir/usr/lib/libSDL2-2.0.so.0
./appimagetool-x86_64.AppImage AppDir
mv ES-DE-x86_64.AppImage ES-DE_x64_SteamDeck.AppImage
echo -e "\nCreated AppImage ES-DE_x64_SteamDeck.AppImage"