reverted build-debug-apk.yml #32
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: Build debug APK | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| permissions: | |
| contents: write | |
| jobs: | |
| Gradle: | |
| if: endsWith(github.event.head_commit.message, 'workflow build') && github.actor != 'github-actions[bot]' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Ensure Gradle wrapper exists | |
| run: | | |
| if [ ! -f "gradlew" ]; then | |
| echo "Gradle wrapper missing, generating..." | |
| wget https://services.gradle.org/distributions/gradle-9.4.1-bin.zip | |
| unzip -q gradle-9.4.1-bin.zip | |
| ./gradle-9.4.1/bin/gradle wrapper --gradle-version 9.4.1 | |
| else | |
| echo "Gradle wrapper already exists" | |
| fi | |
| - name: Make Gradle executable | |
| run: chmod +x ./gradlew | |
| - name: Setup JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Build Debug APK | |
| run: ./gradlew assembleDebug | |
| - name: Prepare beta builds folder | |
| run: | | |
| rm -rf beta-builds | |
| mkdir -p beta-builds | |
| # UPDATED STEP: Uses find to locate the APK even if it's in a subdirectory | |
| - name: Find and Copy APK | |
| run: | | |
| find app/build/outputs/apk/debug -name "*.apk" -exec cp {} beta-builds/app-debug.apk \; | |
| - name: Commit APK | |
| run: | | |
| git config user.name "github-actions" | |
| git config user.email "github-actions@github.com" | |
| git add beta-builds/app-debug.apk | |
| git commit -m "create beta build APK" || echo "No changes to commit" | |
| git push |