|
| 1 | +name: Manual Release APK |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + app_name: |
| 7 | + description: 'App Name' |
| 8 | + required: true |
| 9 | + default: 'DroidPad' |
| 10 | + tag_name: |
| 11 | + description: 'Tag Name' |
| 12 | + required: true |
| 13 | + |
| 14 | +jobs: |
| 15 | + build-release: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout code |
| 20 | + uses: actions/checkout@v3 |
| 21 | + |
| 22 | + - name: Decode Keystore |
| 23 | + id: decode_keystore |
| 24 | + uses: timheuer/base64-to-file@v1 |
| 25 | + with: |
| 26 | + fileName: "keystore" |
| 27 | + encodedString: ${{ secrets.ANDROID_KEYSTORE_BASE_64 }} |
| 28 | + |
| 29 | + - name: Set up Java |
| 30 | + uses: actions/setup-java@v3 |
| 31 | + with: |
| 32 | + distribution: 'temurin' |
| 33 | + java-version: '17' |
| 34 | + |
| 35 | + - name: Grant execute permission to gradlew |
| 36 | + run: chmod +x ./gradlew |
| 37 | + |
| 38 | + - name: Build APK |
| 39 | + run: | |
| 40 | + ./gradlew assembleRelease \ |
| 41 | + -Pandroid.injected.signing.store.file=${{ steps.decode_keystore.outputs.filePath }} \ |
| 42 | + -Pandroid.injected.signing.store.password=${{ secrets.ANDROID_KEYSTORE_STORE_PASSWORD }} \ |
| 43 | + -Pandroid.injected.signing.key.alias=${{ secrets.ANDROID_KEYSTORE_ALIAS }} \ |
| 44 | + -Pandroid.injected.signing.key.password=${{ secrets.ANDROID_KEYSTORE_PASSWORD }} |
| 45 | +
|
| 46 | + - name: Rename APK |
| 47 | + run: | |
| 48 | + mv app/build/outputs/apk/release/app-release.apk "${{ github.event.inputs.app_name }}-${{ github.event.inputs.tag_name }}.apk" |
| 49 | + echo "renamed_apk=${{ github.event.inputs.app_name }}-${{ github.event.inputs.tag_name }}.apk" >> $GITHUB_ENV |
| 50 | +
|
| 51 | + - name: Upload APK Artifact |
| 52 | + uses: actions/upload-artifact@v4 |
| 53 | + with: |
| 54 | + name: ${{ github.event.inputs.app_name }}-${{ github.event.inputs.tag_name }} |
| 55 | + path: ${{ env.renamed_apk }} |
| 56 | + |
| 57 | + - name: Create Release Draft |
| 58 | + uses: ncipollo/release-action@v1 |
| 59 | + with: |
| 60 | + artifacts: ${{ env.renamed_apk }} |
| 61 | + tag: ${{ github.event.inputs.tag_name }} |
| 62 | + draft: true |
| 63 | + name: ${{ github.event.inputs.tag_name }} |
| 64 | + prerelease: false |
0 commit comments