fix(android,settings): prevent hang when selecting directory; guard S… #9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Nightly F-Droid CI | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the main branch | |
- name: Checkout Main Branch | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
# Step 2: Setup Java with version 17.x | |
- name: Setup Java | |
uses: actions/setup-java@v1 | |
with: | |
java-version: "17.x" | |
# Step 3: Setup Flutter with version 3.29.2 | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v1 | |
with: | |
flutter-version: "3.29.2" | |
# Step 4: Get dependencies | |
- name: Get dependencies | |
run: flutter pub get | |
# Step 5: Decode signing secrets for keystore and properties | |
- name: Decode Signing Secrets | |
env: | |
NIGHTLY_KEYSTORE_B64: ${{ secrets.NIGHTLY_KEYSTORE_B64 }} | |
NIGHTLY_PROPERTIES_B64: ${{ secrets.NIGHTLY_PROPERTIES_B64 }} | |
run: | | |
echo "$NIGHTLY_KEYSTORE_B64" | base64 --decode > android/nightly.jks | |
echo "$NIGHTLY_PROPERTIES_B64" | base64 --decode > android/key_nightly.properties | |
# Step 6: Build the APK with nightly flavor and release mode | |
- name: Build APK | |
run: flutter build apk --flavor nightly --build-number=${{ github.run_number }} --release | |
# Step 7: Verify the APK is signed | |
- name: Verify sign | |
run: keytool -printcert -jarfile build/app/outputs/flutter-apk/app-nightly-release.apk | |
# Step 8: Configure git and push the APK to fdroid-repo branch | |
- name: Configure and push to fdroid-repo | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git fetch origin fdroid-repo:fdroid-repo | |
git checkout fdroid-repo | |
mv build/app/outputs/flutter-apk/app-nightly-release.apk repo/nightly.${{ github.run_number }}.apk | |
git add repo/ | |
git commit -m "chore: Add new signed APK from build ${{ github.run_number }}" | |
# Step 9: Prune old APKs, keeping only the 5 most recent | |
- name: Prune Old APKs | |
run: | | |
echo "Checking for old APKs to prune..." | |
if [ $(ls -1 repo/*.apk 2>/dev/null | wc -l) -gt 5 ]; then | |
echo "More than 5 APKs found. Deleting all but the 5 most recent..." | |
ls -1 repo/*.apk | sort -V | head -n -5 | xargs rm -f | |
else | |
echo "5 or fewer APKs found. No cleanup needed." | |
fi | |
# Step 10: Setup F-Droid (install fdroidserver) and update the repo | |
- name: Fdroid Install | |
uses: subosito/flutter-action@v1 | |
- name: Run F-Droid Update | |
env: | |
FDROID_CONFIG_YML_B64: ${{ secrets.FDROID_CONFIG_YML }} | |
FDROID_KEYSTORE_P12_B64: ${{ secrets.FDROID_KEYSTORE_P12 }} | |
run: | | |
# Decode the secrets into files | |
echo $FDROID_CONFIG_YML_B64 | base64 --decode > config.yml | |
echo $FDROID_KEYSTORE_P12_B64 | base64 --decode > keystore.p12 | |
# Install fdroidserver | |
sudo apt-get update | |
sudo apt-get install -y fdroidserver | |
# Run the update command, referencing the files | |
fdroid update -c | |
# Step 12: Push the updated repo files with amended commit | |
- name: Push F-Droid updates | |
run: | | |
git add . | |
git commit --amend -m "chore: Add new signed APK from build ${{ github.run_number }} and update F-Droid metadata" | |
git push origin fdroid-repo --force |