Add build workflow #1
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 APK | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Check out the repository code | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # Set up JDK 17 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: "17" | |
| distribution: "temurin" | |
| # Set up Android SDK and NDK | |
| - name: Set up Android SDK | |
| uses: android-actions/setup-android@v3 | |
| with: | |
| sdk-version: "34" | |
| ndk-version: "27.2.12479018" # NDK r27c | |
| # Cache Gradle dependencies | |
| - name: Cache Gradle packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| # Grant execute permission for gradlew | |
| - name: Make gradlew executable | |
| run: chmod +x ./gradlew | |
| # Build the APK | |
| - name: Build debug APK | |
| run: ./gradlew assembleDebug | |
| env: | |
| ANDROID_SDK_ROOT: ${{ env.ANDROID_HOME }} | |
| ANDROID_NDK_HOME: ${{ env.ANDROID_NDK_HOME }} | |
| # Upload the APK as an artifact | |
| - name: Upload APK | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: raymob-debug-apk | |
| path: app/build/outputs/apk/debug/app-debug.apk |