fix java home configuration and yaml formatting in workflow #5
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 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 11 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '11' | |
| distribution: 'temurin' | |
| - name: Set JAVA_HOME | |
| run: | | |
| echo "JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV | |
| echo "PATH=$JAVA_HOME/bin:$PATH" >> $GITHUB_ENV | |
| - 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: Build Debug APK | |
| run: ./gradlew assembleDebug | |
| - name: Build Release APK | |
| run: ./gradlew assembleRelease | |
| - 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@v1 | |
| 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 }} | |
| ### installation instructions | |
| 1. **download apk**: download `notodata-release-v${{ steps.version.outputs.version }}.apk` below | |
| 2. **enable unknown sources**: go to settings → security → install unknown apps → enable for your browser | |
| 3. **install**: open the apk file and follow the prompts | |
| 4. **grant permissions**: allow notification access when prompted | |
| ### what's new | |
| see [changelog.md](https://github.com/${{ github.repository }}/blob/main/changelog.md) for detailed changes. | |
| ### file downloads | |
| - **`notodata-release-v${{ steps.version.outputs.version }}.apk`** - recommended for general use | |
| - **`notodata-debug-v${{ steps.version.outputs.version }}.apk`** - debug version with extra logging | |
| ### issues? | |
| report bugs or ask questions in the [issues](https://github.com/${{ github.repository }}/issues) section. | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |