APK Release Draft #2
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: APK Release Draft | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| app_name: | |
| description: 'App Name' | |
| required: true | |
| default: 'DroidPad' | |
| tag_name: | |
| description: 'Tag Name' | |
| required: true | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Decode Keystore | |
| id: decode_keystore | |
| uses: timheuer/base64-to-file@v1 | |
| with: | |
| fileName: "keystore" | |
| encodedString: ${{ secrets.ANDROID_KEYSTORE_BASE_64 }} | |
| - name: Set up Java | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Grant execute permission to gradlew | |
| run: chmod +x ./gradlew | |
| - name: Build APK | |
| run: | | |
| ./gradlew assembleRelease \ | |
| -Pandroid.injected.signing.store.file=${{ steps.decode_keystore.outputs.filePath }} \ | |
| -Pandroid.injected.signing.store.password=${{ secrets.ANDROID_KEYSTORE_STORE_PASSWORD }} \ | |
| -Pandroid.injected.signing.key.alias=${{ secrets.ANDROID_KEYSTORE_ALIAS }} \ | |
| -Pandroid.injected.signing.key.password=${{ secrets.ANDROID_KEYSTORE_PASSWORD }} | |
| - name: Rename APK | |
| run: | | |
| mv app/build/outputs/apk/release/app-release.apk "${{ github.event.inputs.app_name }}-${{ github.event.inputs.tag_name }}.apk" | |
| echo "renamed_apk=${{ github.event.inputs.app_name }}-${{ github.event.inputs.tag_name }}.apk" >> $GITHUB_ENV | |
| - name: Upload APK Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ github.event.inputs.app_name }}-${{ github.event.inputs.tag_name }} | |
| path: ${{ env.renamed_apk }} | |
| - name: Create Release Draft | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| artifacts: ${{ env.renamed_apk }} | |
| tag: ${{ github.event.inputs.tag_name }} | |
| draft: true | |
| name: ${{ github.event.inputs.tag_name }} | |
| prerelease: false |