WORKFLOW: refact cooker-persistent

This commit is contained in:
XargonWan 2023-12-21 13:43:35 +01:00
parent bfd0e8ae91
commit 1db1972195
7 changed files with 79 additions and 66 deletions

View file

@ -64,7 +64,7 @@ jobs:
- name: "Build flatpak: download only"
id: "flatpak-download"
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_download_only.sh"
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_download_only_persistent.sh"
continue-on-error: true
# Sometimes flatpak download fails, in this case it tries a second time
@ -76,10 +76,10 @@ jobs:
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"
"${GITHUB_WORKSPACE}/automation_tools/flatpak_build_download_only_persistent.sh"
- name: Build flatpak
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_only.sh"
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_only_persistent.sh"
- name: Create Artifact for flathub
run: |
@ -90,7 +90,7 @@ jobs:
continue-on-error: true
- name: Create Bundle
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_bundle.sh"
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_bundle_persistent.sh"
- name: Set environment variable with current branch name
run: echo "GITHUB_REF_SLUG=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV

View file

@ -2,17 +2,8 @@
# This is building the bundle RetroDECK.flatpak after the download and build steps are done
if [ $PERSISTENCE==true ]; then
GITHUB_WORKSPACE_BACKUP="$GITHUB_WORKSPACE"
GITHUB_WORKSPACE="$HOME/cooker-persistent"
fi
if [ "${GITHUB_REF##*/}" = "main" ]; then
flatpak build-bundle ${GITHUB_WORKSPACE}/.local $GITHUB_WORKSPACE/RetroDECK.flatpak net.retrodeck.retrodeck
flatpak build-bundle "${GITHUB_WORKSPACE}/.local" "$GITHUB_WORKSPACE/RetroDECK.flatpak" net.retrodeck.retrodeck
else
flatpak build-bundle ${GITHUB_WORKSPACE}/.local $GITHUB_WORKSPACE/RetroDECK-cooker.flatpak net.retrodeck.retrodeck
fi
if [ $PERSISTENCE==true ]; then
GITHUB_WORKSPACE="$GITHUB_WORKSPACE_BACKUP"
flatpak build-bundle "${GITHUB_WORKSPACE}/.local" "$GITHUB_WORKSPACE/RetroDECK-cooker.flatpak" net.retrodeck.retrodeck
fi

View file

@ -0,0 +1,12 @@
#!/bin/bash
# This is building the bundle RetroDECK.flatpak after the download and build steps are done
BUILD_DIR="$HOME/cooker-persistent"
mkdir -p "$BUILD_DIR"
if [ "${GITHUB_REF##*/}" = "main" ]; then
flatpak build-bundle "${BUILD_DIR}/.local" "$GITHUB_WORKSPACE/RetroDECK.flatpak" net.retrodeck.retrodeck
else
flatpak build-bundle "${BUILD_DIR}/.local" "$GITHUB_WORKSPACE/RetroDECK-cooker.flatpak" net.retrodeck.retrodeck
fi

View file

@ -12,32 +12,13 @@ else
FOLDER=retrodeck-flatpak-cooker
fi
if [ $PERSISTENCE==true ]; then
GITHUB_WORKSPACE_BACKUP="$GITHUB_WORKSPACE"
GITHUB_WORKSPACE="$HOME/cooker-persistent"
mkdir -vp "${GITHUB_WORKSPACE}"/{.local,retrodeck-flatpak-cooker}
mkdir -vp "${GITHUB_WORKSPACE}"/{local,retrodeck-flatpak-cooker}
flatpak-builder --user --force-clean \
flatpak-builder --user --force-clean \
--install-deps-from=flathub \
--install-deps-from=flathub-beta \
--repo="${GITHUB_WORKSPACE}/.local" \
--download-only \
"${GITHUB_WORKSPACE}/${FOLDER}" \
"${GITHUB_WORKSPACE_BACKUP}/net.retrodeck.retrodeck.yml"
GITHUB_WORKSPACE="$GITHUB_WORKSPACE_BACKUP"
else
mkdir -vp "${GITHUB_WORKSPACE}"/{.local,retrodeck-flatpak-cooker}
flatpak-builder --user --force-clean \
--install-deps-from=flathub \
--install-deps-from=flathub-beta \
--repo="${GITHUB_WORKSPACE}/.local" \
--download-only \
"${GITHUB_WORKSPACE}/${FOLDER}" \
net.retrodeck.retrodeck.yml
fi
net.retrodeck.retrodeck.yml

View file

@ -0,0 +1,26 @@
#!/bin/bash
# This script is downloading the needed files to prepare the manifest build
git config --global protocol.file.allow always
if [[ "${GITHUB_REF##*/}" == "main" ]]; then
BUNDLE_NAME="RetroDECK.flatpak"
FOLDER=retrodeck-flatpak
else
BUNDLE_NAME="RetroDECK-cooker.flatpak"
FOLDER=retrodeck-flatpak-cooker
fi
BUILD_DIR="$HOME/cooker-persistent"
mkdir -p "$BUILD_DIR"
mkdir -vp "${BUILD_DIR}"/{.local,retrodeck-flatpak-cooker}
flatpak-builder --user --force-clean \
--install-deps-from=flathub \
--install-deps-from=flathub-beta \
--repo="${BUILD_DIR}/.local" \
--download-only \
"${BUILD_DIR}/${FOLDER}" \
"${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml"

View file

@ -12,35 +12,13 @@ else
FOLDER=retrodeck-flatpak-cooker
fi
if [ $PERSISTENCE==true ]; then
mkdir -vp ${GITHUB_WORKSPACE}/.local
mkdir -vp ${GITHUB_WORKSPACE}/"$FOLDER"
GITHUB_WORKSPACE_BACKUP="$GITHUB_WORKSPACE"
GITHUB_WORKSPACE="$HOME/cooker-persistent"
mkdir -vp ${GITHUB_WORKSPACE}/.local
mkdir -vp ${GITHUB_WORKSPACE}/"$FOLDER"
flatpak-builder --user --force-clean \
flatpak-builder --user --force-clean \
--install-deps-from=flathub \
--install-deps-from=flathub-beta \
--repo="${GITHUB_WORKSPACE}/.local" \
--repo=${GITHUB_WORKSPACE}/.local \
--disable-download \
"${GITHUB_WORKSPACE}/${FOLDER}" \
"${GITHUB_WORKSPACE_BACKUP}/net.retrodeck.retrodeck.yml"
GITHUB_WORKSPACE="$GITHUB_WORKSPACE_BACKUP"
else
mkdir -vp ${GITHUB_WORKSPACE}/.local
mkdir -vp ${GITHUB_WORKSPACE}/"$FOLDER"
flatpak-builder --user --force-clean \
--install-deps-from=flathub \
--install-deps-from=flathub-beta \
--repo=${GITHUB_WORKSPACE}/.local \
--disable-download \
${GITHUB_WORKSPACE}/"$FOLDER" \
net.retrodeck.retrodeck.yml
fi
"${GITHUB_WORKSPACE}/$FOLDER" \
net.retrodeck.retrodeck.yml

View file

@ -0,0 +1,25 @@
#!/bin/bash
# This script is downloading the needed files to prepare the manifest build
git config protocol.file.allow always
if [ "${GITHUB_REF##*/}" = "main" ]; then
BUNDLE_NAME="RetroDECK.flatpak"
FOLDER=retrodeck-flatpak-main
else
BUNDLE_NAME="RetroDECK-cooker.flatpak"
FOLDER=retrodeck-flatpak-cooker
fi
BUILD_DIR="$HOME/cooker-persistent"
mkdir -vp ${$BUILD_DIR}/.local
mkdir -vp ${$BUILD_DIR}/"$FOLDER"
flatpak-builder --user --force-clean \
--install-deps-from=flathub \
--install-deps-from=flathub-beta \
--repo="${BUILD_DIR}/.local" \
--disable-download \
"${BUILD_DIR}/${FOLDER}" \
"${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml"