From 3926e73160ed36660a29fdc5d35487c62302e934 Mon Sep 17 00:00:00 2001 From: XargonWan <6771419+XargonWan@users.noreply.github.com> Date: Sat, 8 Oct 2022 14:53:30 +0200 Subject: [PATCH] Edited flathub push workflow --- .github/workflows/flathub_push_cooker.yml | 59 +++++++++-------------- flathub.yml | 5 +- 2 files changed, 25 insertions(+), 39 deletions(-) diff --git a/.github/workflows/flathub_push_cooker.yml b/.github/workflows/flathub_push_cooker.yml index 788a47f9..11111b11 100644 --- a/.github/workflows/flathub_push_cooker.yml +++ b/.github/workflows/flathub_push_cooker.yml @@ -2,13 +2,6 @@ name: PUSH-cooker-flathub on: -# push: -# branches: -# - cooker* -# pull_request: -# branches: -# - cooker* - workflow_dispatch: jobs: @@ -20,11 +13,11 @@ jobs: shell: bash run: | # EDITABLES: - rd_branch="cooker" + rd_branch=${GITHUB_HEAD_REF} gits_folder="${GITHUB_WORKSPACE}/gits" # without last / # NON-EDITABLES - branch="$rd_branch-"$(date +%d%m%y.%H%M) + relname="$rd_branch-"$(date +%d%m%y.%H%M) mkdir -vp $gits_folder cd $gits_folder @@ -43,47 +36,43 @@ jobs: #sync -rav --progress --exclude={'res/screenshots/','shared-modules/','rd-submodules/retroarch','.git/','docs','retrodeck-flatpak/','retrodeck-flatpak-cooker/','.flatpak-builder/'} ~/RetroDECK/ ~/flathub/ cd $gits_folder/flathub - git checkout -b $branch + git checkout -b $relname git rm -rf * git clean -fxd # restroing git index # Copying only a few files as the others are cloned by git in retrodeck.sh cd $gits_folder/RetroDECK cp -rf \ - 'rd-submodules' \ 'flathub.json' \ 'LICENSE' \ - 'net.retrodeck.retrodeck.appdata.xml' \ - 'net.retrodeck.retrodeck.desktop' \ - 'net.retrodeck.retrodeck.yml' \ + 'flathub.yml' \ 'README.md' \ $gits_folder/flathub/ cd $gits_folder/flathub - ls -la + ls -lah - if [ -d .git/modules ]; then - rm -rfv .git/modules/* - fi + # manipulating manifest + mv flathub.yml net.retrodeck.retrodeck.yml - # Adding the real submodules, please update this every time a submodule is added - - if [ -d shared-modules ]; then - git rm -rf --ignore-unmatch shared-modules - rm -rfv shared-modules - fi - git submodule add https://github.com/flathub/shared-modules.git ./shared-modules + version=$(\ + curl -sL \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.TRIGGER_BUILD_TOKEN }}" \ + | jq .name \ + ) - if [ -d rd-submodules/retroarch ]; then - git rm -rf --ignore-unmatch rd-submodules/retroarch - rm -rfv rd-submodules/retroarch - fi - git submodule add https://github.com/flathub/org.libretro.RetroArch.git ./rd-submodules/retroarch + sha=$(curl -sL https://github.com/XargonWan/RetroDECK-cooker/releases/download/$version/RetroDECK-Artifact.sha) + + sha="$(cat 'RetroDECK-Artifact.sha')" + sed -i 's#"url: https://github.com/XargonWan/RetroDECK-cooker/releases/download/__VERSION__/RetroDECK-Artifact.tar.gz"#"url: https://github.com/XargonWan/RetroDECK-cooker/releases/download/$version/RetroDECK-Artifact.tar.gz"#g' net.retrodeck.retrodeck.yml + sed -i 's#"sha256: __SHA__"#"sha256: $sha"#g' net.retrodeck.retrodeck.yml + + echo -e "Resulting manifest:\n" + cat net.retrodeck.retrodeck.yml - # unbinds all submodules - git submodule deinit -f . - # checkout again - git submodule update --init --recursive git add * git commit -m "Updated flathub/net.retrodeck.retrodeck from RetroDECK/$rd_branch" - git push origin $branch \ No newline at end of file + git config --local user.name ${{ secrets.GITNAME }} + git config --local user.email ${{ secrets.GITMAIL }} + git push origin $relname \ No newline at end of file diff --git a/flathub.yml b/flathub.yml index 827906ca..5166c788 100644 --- a/flathub.yml +++ b/flathub.yml @@ -42,7 +42,4 @@ modules: sources: - type: archive url: https://github.com/XargonWan/RetroDECK-cooker/releases/download/__VERSION__/RetroDECK-Artifact.tar.gz - sha256: __SHA__ - -# seddare version e sha -# modificare il wf flathub-push mettendo le credential e il flathub.yml modificato \ No newline at end of file + sha256: __SHA__ \ No newline at end of file