Edited flathub push workflow

This commit is contained in:
XargonWan 2022-10-08 14:53:30 +02:00
parent 66c92bbc28
commit 3926e73160
2 changed files with 25 additions and 39 deletions

View file

@ -2,13 +2,6 @@
name: PUSH-cooker-flathub name: PUSH-cooker-flathub
on: on:
# push:
# branches:
# - cooker*
# pull_request:
# branches:
# - cooker*
workflow_dispatch: workflow_dispatch:
jobs: jobs:
@ -20,11 +13,11 @@ jobs:
shell: bash shell: bash
run: | run: |
# EDITABLES: # EDITABLES:
rd_branch="cooker" rd_branch=${GITHUB_HEAD_REF}
gits_folder="${GITHUB_WORKSPACE}/gits" # without last / gits_folder="${GITHUB_WORKSPACE}/gits" # without last /
# NON-EDITABLES # NON-EDITABLES
branch="$rd_branch-"$(date +%d%m%y.%H%M) relname="$rd_branch-"$(date +%d%m%y.%H%M)
mkdir -vp $gits_folder mkdir -vp $gits_folder
cd $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/ #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 cd $gits_folder/flathub
git checkout -b $branch git checkout -b $relname
git rm -rf * git rm -rf *
git clean -fxd # restroing git index git clean -fxd # restroing git index
# Copying only a few files as the others are cloned by git in retrodeck.sh # Copying only a few files as the others are cloned by git in retrodeck.sh
cd $gits_folder/RetroDECK cd $gits_folder/RetroDECK
cp -rf \ cp -rf \
'rd-submodules' \
'flathub.json' \ 'flathub.json' \
'LICENSE' \ 'LICENSE' \
'net.retrodeck.retrodeck.appdata.xml' \ 'flathub.yml' \
'net.retrodeck.retrodeck.desktop' \
'net.retrodeck.retrodeck.yml' \
'README.md' \ 'README.md' \
$gits_folder/flathub/ $gits_folder/flathub/
cd $gits_folder/flathub cd $gits_folder/flathub
ls -la ls -lah
if [ -d .git/modules ]; then # manipulating manifest
rm -rfv .git/modules/* mv flathub.yml net.retrodeck.retrodeck.yml
fi
# Adding the real submodules, please update this every time a submodule is added version=$(\
curl -sL \
if [ -d shared-modules ]; then -H "Accept: application/vnd.github+json" \
git rm -rf --ignore-unmatch shared-modules -H "Authorization: Bearer ${{ secrets.TRIGGER_BUILD_TOKEN }}" \
rm -rfv shared-modules | jq .name \
fi )
git submodule add https://github.com/flathub/shared-modules.git ./shared-modules
if [ -d rd-submodules/retroarch ]; then sha=$(curl -sL https://github.com/XargonWan/RetroDECK-cooker/releases/download/$version/RetroDECK-Artifact.sha)
git rm -rf --ignore-unmatch rd-submodules/retroarch
rm -rfv rd-submodules/retroarch sha="$(cat 'RetroDECK-Artifact.sha')"
fi 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
git submodule add https://github.com/flathub/org.libretro.RetroArch.git ./rd-submodules/retroarch 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 add *
git commit -m "Updated flathub/net.retrodeck.retrodeck from RetroDECK/$rd_branch" git commit -m "Updated flathub/net.retrodeck.retrodeck from RetroDECK/$rd_branch"
git push origin $branch git config --local user.name ${{ secrets.GITNAME }}
git config --local user.email ${{ secrets.GITMAIL }}
git push origin $relname

View file

@ -42,7 +42,4 @@ modules:
sources: sources:
- type: archive - type: archive
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
sha256: __SHA__ sha256: __SHA__
# seddare version e sha
# modificare il wf flathub-push mettendo le credential e il flathub.yml modificato