diff --git a/.github/workflows/fdroid.yml b/.github/workflows/fdroid.yml index 36357b4..408d21f 100644 --- a/.github/workflows/fdroid.yml +++ b/.github/workflows/fdroid.yml @@ -44,12 +44,17 @@ jobs: chmod 0600 fdroid/config.yml chmod 0600 fdroid/keystore.p12 + - name: Download releases + run: ./download.sh + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Run lint run: fdroid lint working-directory: ./fdroid - name: Run update - run: fdroid update + run: fdroid update --create-metadata --pretty --rename-apks working-directory: ./fdroid - name: Setup Pages diff --git a/download.sh b/download.sh new file mode 100755 index 0000000..37613bc --- /dev/null +++ b/download.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +if ! command -v gh $> /dev/null +then + echo "gh could not be found, please install GitHub CLI" + exit 1 +fi + +load_app_versions () { + gh release list -R $1 --limit 200 --json=tagName,isPrerelease --jq ".[] | select(.isPrerelease == $2) | .tagName" --exclude-drafts > $3 +} + +load_apps () { + counter=1 + while [ $counter -le $2 ] + do + version=$(sed "${counter}q;d" $3) + file=fdroid/repo/${4}-${version}.apk + gh release download -R $1 $version -O $file + ((counter++)) + done +} + +update_metadata () { + gh repo clone $1 tmp/$1 + rm -r fdroid/metadata/$3 || true + cp -r tmp/$1/$2/fastlane/metadata/android/ fdroid/metadata/$3 +} + +mkdir -p tmp + +load_app_versions thunderbird/thunderbird-android true tmp/k9-beta-versions.txt + +load_apps thunderbird/thunderbird-android 10 tmp/k9-beta-versions.txt k9-beta + +update_metadata thunderbird/thunderbird-android app-k9mail com.fsck.k9