build(android): add fdroid distribution flavor

This commit is contained in:
Tommaso Casaburi
2026-04-30 18:58:50 +07:00
parent ea03d04cd9
commit fdbb650baa
25 changed files with 259 additions and 75 deletions
+2 -2
View File
@@ -175,8 +175,8 @@ jobs:
- name: Sync Capacitor Android project
run: npx cap sync android
- name: Run Android unit tests and assemble debug APK
run: cd android && ./gradlew testDebugUnitTest assembleDebug --stacktrace
- name: Run Android unit tests and assemble debug APKs
run: cd android && ./gradlew testGithubDebugUnitTest testFdroidDebugUnitTest assembleGithubDebug assembleFdroidDebug --stacktrace
package-linux:
name: Package Linux (Ubuntu)
+10 -8
View File
@@ -263,28 +263,30 @@ jobs:
run: CI='' NODE_ENV=production yarn build
- name: Set Android versionCode and versionName
run: |
sed -i "s/versionCode 1/versionCode $(git tag | wc -l)/" ./android/app/build.gradle
sed -i "s/versionName \"1.0\"/versionName \"$(node -e "console.log(require('./package.json').version)")\"/" ./android/app/build.gradle
cat ./android/app/build.gradle
VERSION=$(node -e "console.log(require('./package.json').version)")
VERSION_CODE=$(node -e "const [major = 0, minor = 0, patch = 0] = require('./package.json').version.replace(/^v/, '').split('-')[0].split('.').map(Number); console.log((major * 10000) + (minor * 100) + patch)")
echo "APP_VERSION_NAME=${VERSION}" >> "$GITHUB_ENV"
echo "APP_VERSION_CODE=${VERSION_CODE}" >> "$GITHUB_ENV"
echo "Android versionName=${VERSION} versionCode=${VERSION_CODE}"
- name: Sync Capacitor
run: npx cap sync android
- name: Build APK
run: |
for i in 1 2 3; do
echo "gradlew assembleRelease attempt $i"
(cd android && ./gradlew assembleRelease --stacktrace) && break
echo "gradlew assembleGithubRelease attempt $i"
(cd android && ./gradlew assembleGithubRelease -PAPP_VERSION_NAME="${APP_VERSION_NAME}" -PAPP_VERSION_CODE="${APP_VERSION_CODE}" --stacktrace) && break
sleep 10
[ "$i" = "3" ] && exit 1
done
- name: Optimize APK
run: cd android/app/build/outputs/apk/release && zipalign 4 app-release-unsigned.apk app-release-unsigned-zip.apk
run: cd android/app/build/outputs/apk/github/release && zipalign 4 app-github-release-unsigned.apk app-github-release-unsigned-zip.apk
- name: Sign APK
run: cd android/app/build/outputs/apk/release && apksigner sign --ks ../../../../../plebbit.keystore --ks-pass pass:${{ secrets.PLEBBIT_REACT_KEYSTORE_PASSWORD }} --ks-key-alias release --out app-release-signed.apk app-release-unsigned-zip.apk
run: cd android/app/build/outputs/apk/github/release && apksigner sign --ks ../../../../../../plebbit.keystore --ks-pass pass:${{ secrets.PLEBBIT_REACT_KEYSTORE_PASSWORD }} --ks-key-alias release --out app-github-release-signed.apk app-github-release-unsigned-zip.apk
- name: Stage release artifacts
run: |
mkdir -p release-assets
VERSION=$(node -e "console.log(require('./package.json').version)")
mv android/app/build/outputs/apk/release/app-release-signed.apk "release-assets/5chan-${VERSION}.apk"
mv android/app/build/outputs/apk/github/release/app-github-release-signed.apk "release-assets/5chan-${VERSION}.apk"
- name: List release assets
run: ls -la release-assets
- uses: actions/upload-artifact@v4