Prequel: GitHub Actions 101
Preface
As RetroArch still hasn’t made its way to F-Droid as of October 2022, I decide to give GitHub Actions another try.
Idea
Same as the previous one. I’ll use fdroid and follow its setup instruction .
Progress
On my DevuanWSL, init the project:
# Make sure to install the 2.x.x version, although as long as you're not using oldstable, it should be fine
# https://tracker.debian.org/pkg/fdroidserver
apt-cache policy fdroidserver
sudo apt install fdroidserver
git clone --depth=1 https://github.com/xarantolus/fdroid
cd fdroid
# Watch out, don't delete the repo itself…
rm -rf ./fdroid
rm -rf .git
git init
mkdir ./fdroid
cd ./fdroid
# It will complain `No Android SDK`, but it's fine if you don't use it to build app
fdroid init
Change fdroid/config.yml
as instructed:
repo_url: https://raw.githubusercontent.com/Vinfall/fdroid/main/fdroid/repo
#repo_url: https://fdroid.vinfall.com
repo_name: RetroArch Nightly F-Droid Repo (unofficial)
repo_description: >-
This is an UNOFFICIAL RetroArch nightly repository compatible with F-Droid.
Applications in this repository are official binaries built by the original
application developers.
archive_older: 0
Add repo secrets (NOT env secrets):
# Save the output as `CONFIG_YML` repo secret
base64 config.yml
# Save the output as `KEYSTORE_P12` repo secret
base64 keystore.p12
Go here to grab a personal access token WITHOUT any scopes and preferably No expiration, save it as GH_ACCESS_TOKEN
repo secret.
Then edit apps.yaml
as instructed. For RetroArch specifically, I get most of the content from F-Droid RFP recipe and F-Droid official Build Metadata Reference .
I add a new Multimedia
category as RetroArch does offer content management for images, music, videos etc.
Also, the really obsolete LibRetro F-Droid repo offers an insight for how the files should structure.
I download icons/retroarch.png
and renamed it to icons/icon.png
(so I don’t have to explicitly specify its name in config.yml
), downloaded the app from Buildbot and placed it under repo
.
I don’t know why, but running I figure it out, so why does the warning says to place it in fdroid update -c
always throws WARNING: repo_icon "repo/icons/icon.png" does not exist! Check "config.yml".
even if I have repo/icons/icon.png
and even metadata/icon.png
in place.repo/icons
when I need to place it just in repo
?
After that, the setup doc forgets to mention an important command:
cd fdroid
fdroid update --create-metadata
# Or in short
fdroid update -c
This would generate the necessary metadata or fdroidserver
would always complain about missing index-v1.json
, index-v1.jar
… It took me almost an hour to find out, sigh.
And future update is just add new apks to repo
, run fdroid update -c
, push repo
/archive
to remote, and it’s done.
When an user copy the URL/scan the QR code, the fingerprint is appended automatically.
Ok, now everything should be fine, except that I’ll have to enable Git LFS (by running git lfs track repo/*apk
) to upload the apk and really hosting it would be abusing GitHub’s ToS I’m afraid.
As a result, I failed in the sense of hosting RetroArch nightly F-Droid repo on GitHub, fully automated (after initial setup) by GitHub Action.
However, I set up a real F-Droid repo on VPS the next day, and the process is pretty much the same. Just make sure to generate the key on local machine and use fdroid deploy
to rsync files (so it can never get exposed via misconfigured web server). The update process is also easy to automate (script + cron or just CI).
A sample repo is available on GitHub.
I hope RetroArch team could get it integrated into their CI and put the files in https://buildbot.libretro.com/nightly/android/, this way everyone is happy.
References
- Metadata:
- F-Droid Server Deploy Init: Setup an F-Droid App Repo
- Icons: LibRetro F-Droid Repo
- Install command: Setup an F-Droid App Repo
- Index format: fdroid/fdroid/repo/index.xml
- Real World Setup: Personal F-Droid Repository
- I’m dumb, forgot to
git lfs install
: Upload file > 25 MB on GitHub - I will use this to tag releases but it’s no longer needed: Daily Version GitHub Action