From e315504be63779e465255b8de6a44c3963aaf5d5 Mon Sep 17 00:00:00 2001 From: XargonWan Date: Tue, 26 Sep 2023 09:20:19 +0200 Subject: [PATCH] Outsurcing pipeline commands in bash scripts [skip ci] --- .github/workflows/cooker-selfhosted.yml | 39 ++-------------- .github/workflows/main-selfhosted.yml | 44 ++++--------------- automation_tools/cooker_flatpak_portal_add.sh | 0 automation_tools/flatpak_build_bundle.sh | 5 +++ .../flatpak_build_download_only.sh | 14 ++++++ automation_tools/flatpak_build_only.sh | 14 ++++++ automation_tools/force_update_submodules.sh | 0 ...ion_checker.sh => main_version_checker.sh} | 0 8 files changed, 45 insertions(+), 71 deletions(-) mode change 100644 => 100755 automation_tools/cooker_flatpak_portal_add.sh create mode 100755 automation_tools/flatpak_build_bundle.sh create mode 100755 automation_tools/flatpak_build_download_only.sh create mode 100755 automation_tools/flatpak_build_only.sh mode change 100644 => 100755 automation_tools/force_update_submodules.sh rename automation_tools/{version_checker.sh => main_version_checker.sh} (100%) diff --git a/.github/workflows/cooker-selfhosted.yml b/.github/workflows/cooker-selfhosted.yml index 12d4512b..fc96a040 100644 --- a/.github/workflows/cooker-selfhosted.yml +++ b/.github/workflows/cooker-selfhosted.yml @@ -65,46 +65,16 @@ jobs: - name: "Build flatpak: download only" id: "flatpak-download" - run: | - git config --global protocol.file.allow always - mkdir -vp ${GITHUB_WORKSPACE}/local - mkdir -vp ${GITHUB_WORKSPACE}/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}/retrodeck-flatpak-cooker \ - net.retrodeck.retrodeck.yml + 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: | - git config --global protocol.file.allow always - mkdir -vp ${GITHUB_WORKSPACE}/local - mkdir -vp ${GITHUB_WORKSPACE}/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}/retrodeck-flatpak-cooker \ - net.retrodeck.retrodeck.yml + run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_download_only.sh" - name: Build flatpak - run: | - git config --global protocol.file.allow always - mkdir -vp ${GITHUB_WORKSPACE}/local - mkdir -vp ${GITHUB_WORKSPACE}/retrodeck-flatpak-cooker - flatpak-builder --user --force-clean \ - --install-deps-from=flathub \ - --install-deps-from=flathub-beta \ - --repo=${GITHUB_WORKSPACE}/local \ - --disable-download \ - ${GITHUB_WORKSPACE}/retrodeck-flatpak-cooker \ - net.retrodeck.retrodeck.yml + run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_only.sh" - name: Create Artifact for flathub run: | @@ -115,8 +85,7 @@ jobs: continue-on-error: true - name: Create Bundle - run: | - flatpak build-bundle ${GITHUB_WORKSPACE}/local RetroDECK-cooker.flatpak net.retrodeck.retrodeck + 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 diff --git a/.github/workflows/main-selfhosted.yml b/.github/workflows/main-selfhosted.yml index c380622f..b71961c6 100644 --- a/.github/workflows/main-selfhosted.yml +++ b/.github/workflows/main-selfhosted.yml @@ -52,50 +52,23 @@ jobs: - name: Check versions (main only) id: check_version_string - run: "automation_tools/version_checker.sh" + 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: | - git config --global protocol.file.allow always - mkdir -vp ${GITHUB_WORKSPACE}/local - mkdir -vp ${GITHUB_WORKSPACE}/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}/retrodeck-flatpak-cooker \ - net.retrodeck.retrodeck.yml + 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: | - git config --global protocol.file.allow always - mkdir -vp ${GITHUB_WORKSPACE}/local - mkdir -vp ${GITHUB_WORKSPACE}/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}/retrodeck-flatpak-cooker \ - net.retrodeck.retrodeck.yml + run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_download_only.sh" - name: Build flatpak - run: | - git config --global protocol.file.allow always - mkdir -vp ${GITHUB_WORKSPACE}/local - mkdir -vp ${GITHUB_WORKSPACE}/retrodeck-flatpak-cooker - flatpak-builder --user --force-clean \ - --install-deps-from=flathub \ - --install-deps-from=flathub-beta \ - --repo=${GITHUB_WORKSPACE}/local \ - --disable-download \ - ${GITHUB_WORKSPACE}/retrodeck-flatpak-cooker \ - net.retrodeck.retrodeck.yml + run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_only.sh" - name: Create Artifact for flathub run: | @@ -106,8 +79,7 @@ jobs: continue-on-error: true - name: Create Bundle - run: | - flatpak build-bundle ${GITHUB_WORKSPACE}/local RetroDECK.flatpak net.retrodeck.retrodeck + run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_bundle.sh" - name: Getting version info id: version diff --git a/automation_tools/cooker_flatpak_portal_add.sh b/automation_tools/cooker_flatpak_portal_add.sh old mode 100644 new mode 100755 diff --git a/automation_tools/flatpak_build_bundle.sh b/automation_tools/flatpak_build_bundle.sh new file mode 100755 index 00000000..8c155810 --- /dev/null +++ b/automation_tools/flatpak_build_bundle.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# This is building the bundle RetroDECK.flatpak after the download and build steps are done + +flatpak build-bundle ${GITHUB_WORKSPACE}/local RetroDECK-cooker.flatpak net.retrodeck.retrodeck \ No newline at end of file diff --git a/automation_tools/flatpak_build_download_only.sh b/automation_tools/flatpak_build_download_only.sh new file mode 100755 index 00000000..55352780 --- /dev/null +++ b/automation_tools/flatpak_build_download_only.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# This script is downloading the needed files to prepare the manifest build + +git config --global protocol.file.allow always +mkdir -vp ${GITHUB_WORKSPACE}/local +mkdir -vp ${GITHUB_WORKSPACE}/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}/retrodeck-flatpak-cooker \ + net.retrodeck.retrodeck.yml \ No newline at end of file diff --git a/automation_tools/flatpak_build_only.sh b/automation_tools/flatpak_build_only.sh new file mode 100755 index 00000000..d2ed3fe5 --- /dev/null +++ b/automation_tools/flatpak_build_only.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# This script is building the flatpak is the needed files are already downloaded + +git config --global protocol.file.allow always +mkdir -vp ${GITHUB_WORKSPACE}/local +mkdir -vp ${GITHUB_WORKSPACE}/retrodeck-flatpak-cooker +flatpak-builder --user --force-clean \ + --install-deps-from=flathub \ + --install-deps-from=flathub-beta \ + --repo=${GITHUB_WORKSPACE}/local \ + --disable-download \ + ${GITHUB_WORKSPACE}/retrodeck-flatpak-cooker \ + net.retrodeck.retrodeck.yml \ No newline at end of file diff --git a/automation_tools/force_update_submodules.sh b/automation_tools/force_update_submodules.sh old mode 100644 new mode 100755 diff --git a/automation_tools/version_checker.sh b/automation_tools/main_version_checker.sh similarity index 100% rename from automation_tools/version_checker.sh rename to automation_tools/main_version_checker.sh