Android Release #11
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: Android Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag_name: | |
| description: 'Tag name (e.g: 1.0.0)' | |
| required: true | |
| type: string | |
| release_name: | |
| description: 'Release name (e.g: Release 1.0.0)' | |
| required: true | |
| type: string | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| environment: Release | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| cache: 'gradle' | |
| - name: Decode Keystore | |
| run: echo "${{ secrets.SIGNING_KEY }}" | base64 -d > release.jks | |
| - name: Build and Sign Release APK | |
| env: | |
| KEYSTORE_FILE: ${{ github.workspace }}/release.jks | |
| KEY_ALIAS: ${{ secrets.ALIAS }} | |
| KEYSTORE_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| run: ./gradlew assembleRelease | |
| - name: Rename and Cleanup APK | |
| run: | | |
| mv app/build/outputs/apk/release/app-release.apk OpenPillReminder-${{ github.event.inputs.tag_name }}.apk | |
| rm release.jks | |
| - name: Generate APK Hash | |
| id: generate_hash | |
| run: | | |
| sha256=$(sha256sum OpenPillReminder-${{ github.event.inputs.tag_name }}.apk | awk '{ print $1 }') | |
| echo "apk_sha=$sha256" >> $GITHUB_OUTPUT | |
| echo "SHA-256 Hash of APK: $sha256" | |
| - name: Create Draft Release with APK | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| tag_name: ${{ github.event.inputs.tag_name }} | |
| name: ${{ github.event.inputs.release_name }} | |
| draft: true | |
| files: OpenPillReminder-${{ github.event.inputs.tag_name }}.apk | |
| body: | | |
| <!-- Write changelog here --> | |
| --- | |
| ### Security Verification | |
| **APK SHA-256 Hash:** `${{ steps.generate_hash.outputs.apk_sha }}` | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |