Build and Release APK #13
Workflow file for this run
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 and Release APK | |
| on: | |
| push: | |
| tags: | |
| - 'v*' # Triggers on version tags like v1.0, v1.1, etc. | |
| workflow_dispatch: # Allows manual trigger | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Accept Android SDK licenses | |
| run: yes | sdkmanager --licenses || true | |
| - name: Verify Java installation | |
| run: | | |
| java -version | |
| echo "JAVA_HOME: $JAVA_HOME" | |
| - name: Cache Gradle dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Debug Java and Gradle setup | |
| run: | | |
| echo "=== Java Information ===" | |
| java -version | |
| echo "JAVA_HOME: $JAVA_HOME" | |
| echo "PATH: $PATH" | |
| echo "=== Gradle Information ===" | |
| ./gradlew --version | |
| echo "=== System Information ===" | |
| uname -a | |
| - name: Build Debug APK | |
| run: ./gradlew assembleDebug --no-daemon --stacktrace --info | |
| - name: Build Release APK | |
| run: ./gradlew assembleRelease --no-daemon --stacktrace --info | |
| - name: Get version name | |
| id: version | |
| run: | | |
| VERSION=${GITHUB_REF#refs/tags/} | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Rename APKs | |
| run: | | |
| cp app/build/outputs/apk/debug/app-debug.apk notodata-debug-v${{ steps.version.outputs.version }}.apk | |
| cp app/build/outputs/apk/release/app-release-unsigned.apk notodata-release-v${{ steps.version.outputs.version }}.apk | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| files: | | |
| notodata-debug-v${{ steps.version.outputs.version }}.apk | |
| notodata-release-v${{ steps.version.outputs.version }}.apk | |
| body: | | |
| ## notodata v${{ steps.version.outputs.version }} | |
| notification data collection app with properly sized icons | |
| **installation:** | |
| 1. download apk file below | |
| 2. enable unknown sources in android settings | |
| 3. install apk | |
| 4. grant notification access permission | |
| **files:** | |
| - `notodata-release-v${{ steps.version.outputs.version }}.apk` - main release | |
| - `notodata-debug-v${{ steps.version.outputs.version }}.apk` - debug version | |
| draft: false | |
| prerelease: false |