diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c377046..f4932b6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,19 +24,23 @@ jobs: - name: Execute Gradle build run: ./gradlew --no-daemon --build-cache assembleRelease + - name: Get build tools + run: | + BUILD_TOOLS_PATH=/usr/local/lib/android/sdk/build-tools/$(ls /usr/local/lib/android/sdk/build-tools/ | tail -n 1) + echo "BUILD_TOOLS=$BUILD_TOOLS_PATH" >> $GITHUB_ENV + + - name: Zipalign the APK + run: | + $BUILD_TOOLS/zipalign -v 4 app/build/outputs/apk/release/app-release-unsigned.apk app-release-unsigned.apk + - name: Sign the APK run: | echo "${{ secrets.KEYSTORE }}" > keystore.asc gpg -d --passphrase "${{ secrets.KEY_PASSWD }}" --batch keystore.asc > keystore.jks - jarsigner -verbose -sigalg SHA256withRSA -digestalg SHA-256 -keystore keystore.jks -storepass ${{ secrets.KEY_PASSWD }} -keypass ${{ secrets.KEY_PASSWD }} app/build/outputs/apk/release/app-release-unsigned.apk ${{ secrets.KEY_ALIAS }} + $BUILD_TOOLS/apksigner sign --ks keystore.jks --ks-key-alias ${{ secrets.KEY_ALIAS }} --ks-pass pass:${{ secrets.KEY_PASSWD }} --key-pass pass:${{ secrets.KEY_PASSWD }} --out app-release.apk app-release-unsigned.apk - name: Verify the APK signature - run: jarsigner -verify -verbose -certs -keystore keystore.jks -storepass ${{ secrets.KEY_PASSWD }} app/build/outputs/apk/release/app-release-unsigned.apk ${{ secrets.KEY_ALIAS }} - - - name: Zipalign the APK - run: | - BUILD_TOOLS_PATH=/usr/local/lib/android/sdk/build-tools/$(ls /usr/local/lib/android/sdk/build-tools/ | tail -n 1) - $BUILD_TOOLS_PATH/zipalign -v 4 app/build/outputs/apk/release/app-release-unsigned.apk app/build/outputs/apk/release/app-release.apk + run: $BUILD_TOOLS/apksigner verify app-release.apk - name: Create Release id: create_release @@ -55,7 +59,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: app/build/outputs/apk/release/app-release.apk + asset_path: app-release.apk asset_name: linklater-release.apk asset_content_type: application/vnd.android.package-archive