1+ name : Nightly F-Droid CI
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+
8+ jobs :
9+ build :
10+ runs-on : ubuntu-latest
11+
12+ steps :
13+ # Step 1: Checkout the main branch
14+ - name : Checkout Main Branch
15+ uses : actions/checkout@v2
16+ with :
17+ fetch-depth : 0
18+
19+ # Step 2: Setup Java with version 17.x
20+ - name : Setup Java
21+ uses : actions/setup-java@v1
22+ with :
23+ java-version : " 17.x"
24+
25+ # Step 3: Setup Flutter with version 3.29.2
26+ - name : Setup Flutter
27+ uses : subosito/flutter-action@v1
28+ with :
29+ flutter-version : " 3.29.2"
30+
31+ # Step 4: Get dependencies
32+ - name : Get dependencies
33+ run : flutter pub get
34+
35+ # # Step 5: Analyze and test (uncomment if needed)
36+ # - name: Analyze code
37+ # run: flutter analyze --no-fatal-warnings --no-fatal-infos
38+ # # - name: Run tests
39+ # # run: flutter test
40+
41+ # Step 6: Build APK
42+ - name : Build APK
43+ run : |
44+ flutter build apk --build-number=${{ github.run_number }} --release
45+ mv build/app/outputs/flutter-apk/app-release.apk /home/runner/work/com.ccextractor.taskwarriorflutter.apk
46+ # The `--flavor fdroid` is optional but a good practice for F-Droid builds.
47+ # The mv command ensures a unique filename with the build number.
48+
49+ # Step 7: Push the APK to the fdroid-repo branch
50+ - name : Configure and push to fdroid-repo
51+ run : |
52+ # Configure Git credentials with the GITHUB_TOKEN
53+ git config --global user.name "github-actions[bot]"
54+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
55+
56+ # Checkout the fdroid-repo branch
57+ git fetch origin fdroid-repo:fdroid-repo
58+ git checkout fdroid-repo
59+
60+ # Create a directory if it doesn't exist and move the APK
61+ mkdir -p repo
62+ rm -f repo/com.ccextractor.taskwarriorflutter.apk || true
63+ mv /home/runner/work/com.ccextractor.taskwarriorflutter.apk repo/
64+
65+ # Add, commit, and push the new APK file
66+ git add repo/
67+ git commit -m "chore: Add new APK from build ${{ github.run_number }}"
68+ git push origin fdroid-repo
69+
70+ # Step 8: Setup f-droid and run update
71+ - name : Setup F-Droid
72+ uses : subosito/flutter-action@v1 # A common action, but you'll need to install fdroidserver
73+ - name : Run F-Droid Update
74+ env :
75+ FDROID_CONFIG_YML_B64 : ${{ secrets.FDROID_CONFIG_YML }}
76+ FDROID_KEYSTORE_P12_B64 : ${{ secrets.FDROID_KEYSTORE_P12 }}
77+ run : |
78+ # Decode the secrets into files
79+ echo $FDROID_CONFIG_YML_B64 | base64 --decode > config.yml
80+ echo $FDROID_KEYSTORE_P12_B64 | base64 --decode > keystore.p12
81+
82+ # Install fdroidserver
83+ sudo apt-get update
84+ sudo apt-get install -y fdroidserver
85+
86+ # Run the update command, referencing the files
87+ fdroid update -c
88+
89+ # Step 9: Push the updated repo files
90+ - name : Push F-Droid updates
91+ run : |
92+ git add .
93+ git commit -m "feat: F-Droid repo update n:${{ github.run_number }}"
94+ git push origin fdroid-repo
0 commit comments