diff --git a/.github/workflows/flutterci.yml b/.github/workflows/flutterci.yml index 25df90da..1bfeb5b8 100644 --- a/.github/workflows/flutterci.yml +++ b/.github/workflows/flutterci.yml @@ -1,10 +1,6 @@ name: Flutter CI on: - push: - branches: - - main - - reports pull_request: branches: - main diff --git a/.github/workflows/nightlydepolyci.yml b/.github/workflows/nightlydepolyci.yml new file mode 100644 index 00000000..41ca3ffc --- /dev/null +++ b/.github/workflows/nightlydepolyci.yml @@ -0,0 +1,94 @@ +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: Analyze and test (uncomment if needed) + # - name: Analyze code + # run: flutter analyze --no-fatal-warnings --no-fatal-infos + # # - name: Run tests + # # run: flutter test + + # Step 6: Build APK + - name: Build APK + run: | + flutter build apk --build-number=${{ github.run_number }} --release + mv build/app/outputs/flutter-apk/app-release.apk /home/runner/work/com.ccextractor.taskwarriorflutter.apk + # The `--flavor fdroid` is optional but a good practice for F-Droid builds. + # The mv command ensures a unique filename with the build number. + + # Step 7: Push the APK to the fdroid-repo branch + - name: Configure and push to fdroid-repo + run: | + # Configure Git credentials with the GITHUB_TOKEN + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + + # Checkout the fdroid-repo branch + git fetch origin fdroid-repo:fdroid-repo + git checkout fdroid-repo + + # Create a directory if it doesn't exist and move the APK + mkdir -p repo + rm -f repo/com.ccextractor.taskwarriorflutter.apk || true + mv /home/runner/work/com.ccextractor.taskwarriorflutter.apk repo/ + + # Add, commit, and push the new APK file + git add repo/ + git commit -m "chore: Add new APK from build ${{ github.run_number }}" + git push origin fdroid-repo + + # Step 8: Setup f-droid and run update + - name: Setup F-Droid + uses: subosito/flutter-action@v1 # A common action, but you'll need to install fdroidserver + - 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 9: Push the updated repo files + - name: Push F-Droid updates + run: | + git add . + git commit -m "feat: F-Droid repo update n:${{ github.run_number }}" + git push origin fdroid-repo \ No newline at end of file