From 2fcaa063e427a6a038b8c6c7324823c23a67ce7a Mon Sep 17 00:00:00 2001 From: XargonWan Date: Wed, 20 Dec 2023 10:06:21 +0100 Subject: [PATCH] WORKFLOW: making the automated cooker builder persistent --- .../cooker-selfhosted-persistent.yml | 5 ++- .github/workflows/cooker-selfhosted.yml | 34 +++++++++---------- automation_tools/flatpak_build_bundle.sh | 10 ++++++ .../flatpak_build_download_only.sh | 10 ++++++ automation_tools/flatpak_build_only.sh | 10 ++++++ 5 files changed, 51 insertions(+), 18 deletions(-) diff --git a/.github/workflows/cooker-selfhosted-persistent.yml b/.github/workflows/cooker-selfhosted-persistent.yml index eaa2d3de..bf45a7b1 100644 --- a/.github/workflows/cooker-selfhosted-persistent.yml +++ b/.github/workflows/cooker-selfhosted-persistent.yml @@ -1,4 +1,7 @@ -name: "Build cooker" +name: "Build cooker (persistent)" + +env: + PERSISTENCE: true on: push: diff --git a/.github/workflows/cooker-selfhosted.yml b/.github/workflows/cooker-selfhosted.yml index d0611d43..e8b7aed1 100644 --- a/.github/workflows/cooker-selfhosted.yml +++ b/.github/workflows/cooker-selfhosted.yml @@ -1,23 +1,23 @@ name: "Build cooker" on: - push: - branches: - - cooker* - - feat* - 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* + # push: + # branches: + # - cooker* + # - feat* + # 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* workflow_dispatch: diff --git a/automation_tools/flatpak_build_bundle.sh b/automation_tools/flatpak_build_bundle.sh index ab2847c5..68c1a93f 100755 --- a/automation_tools/flatpak_build_bundle.sh +++ b/automation_tools/flatpak_build_bundle.sh @@ -2,8 +2,18 @@ # This is building the bundle RetroDECK.flatpak after the download and build steps are done +if [ $PERSISTENCE==true ]; then + mkdir -p "$HOME/cooker-persistent" + GITHUB_WORKSPACE_BACKUP="$GITHUB_WORKSPACE" + GITHUB_WORKSPACE="$HOME/cooker-persistent" +fi + if [ "${GITHUB_REF##*/}" = "main" ]; then flatpak build-bundle ${GITHUB_WORKSPACE}/.local RetroDECK.flatpak net.retrodeck.retrodeck else flatpak build-bundle ${GITHUB_WORKSPACE}/.local RetroDECK-cooker.flatpak net.retrodeck.retrodeck +fi + +if [ $PERSISTENCE==true ]; then + GITHUB_WORKSPACE="$GITHUB_WORKSPACE_BACKUP" fi \ No newline at end of file diff --git a/automation_tools/flatpak_build_download_only.sh b/automation_tools/flatpak_build_download_only.sh index d07f118a..520137a6 100755 --- a/automation_tools/flatpak_build_download_only.sh +++ b/automation_tools/flatpak_build_download_only.sh @@ -12,6 +12,12 @@ else FOLDER=retrodeck-flatpak-cooker fi +if [ $PERSISTENCE==true ]; then + mkdir -p "$HOME/cooker-persistent" + GITHUB_WORKSPACE_BACKUP="$GITHUB_WORKSPACE" + GITHUB_WORKSPACE="$HOME/cooker-persistent" +fi + mkdir -vp "${GITHUB_WORKSPACE}"/{local,retrodeck-flatpak-cooker} flatpak-builder --user --force-clean \ @@ -21,3 +27,7 @@ flatpak-builder --user --force-clean \ --download-only \ "${GITHUB_WORKSPACE}/${FOLDER}" \ net.retrodeck.retrodeck.yml + +if [ $PERSISTENCE==true ]; then + GITHUB_WORKSPACE="$GITHUB_WORKSPACE_BACKUP" +fi diff --git a/automation_tools/flatpak_build_only.sh b/automation_tools/flatpak_build_only.sh index 18cc58c0..29959c99 100755 --- a/automation_tools/flatpak_build_only.sh +++ b/automation_tools/flatpak_build_only.sh @@ -12,6 +12,12 @@ else FOLDER=retrodeck-flatpak-cooker fi +if [ $PERSISTENCE==true ]; then + mkdir -p "$HOME/cooker-persistent" + GITHUB_WORKSPACE_BACKUP="$GITHUB_WORKSPACE" + GITHUB_WORKSPACE="$HOME/cooker-persistent" +fi + mkdir -vp ${GITHUB_WORKSPACE}/.local mkdir -vp ${GITHUB_WORKSPACE}/"$FOLDER" @@ -22,3 +28,7 @@ flatpak-builder --user --force-clean \ --disable-download \ ${GITHUB_WORKSPACE}/"$FOLDER" \ net.retrodeck.retrodeck.yml + +if [ $PERSISTENCE==true ]; then + GITHUB_WORKSPACE="$GITHUB_WORKSPACE_BACKUP" +fi