Add missing check. #2358
Workflow file for this run
This file contains 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 Android | |
on: [push, pull_request] | |
env: | |
ANDROID_BUILD_TOOLS_VERSION: '34.0.0' | |
ANDROID_NDK_VERSION: '25.2.9519653' | |
ANDROID_CMAKE_VERSION: '3.22.1' | |
jobs: | |
build_android: | |
strategy: | |
matrix: | |
build-type: ['apk', 'libretro'] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- name: Force Fetch Git Tags | |
run: git fetch --tags --force | |
- name: Set SHORT_HASH | |
run: echo "VALUE=${LONG_HASH:0:8}" >> $GITHUB_OUTPUT | |
id: short_hash | |
env: | |
LONG_HASH: ${{ github.sha }} | |
- name: Build APK/AAB | |
if: ${{ matrix.build-type == 'apk' }} | |
run: | | |
cd build_android | |
./gradlew | |
./gradlew assembleRelease | |
./gradlew bundleRelease | |
- name: Build libretro Core | |
if: ${{ matrix.build-type == 'libretro' }} | |
run: | | |
CMAKE_PATH=${ANDROID_SDK_ROOT}/cmake/${{ env.ANDROID_CMAKE_VERSION }} | |
export PATH=${CMAKE_PATH}/bin:$PATH | |
export NINJA_EXE=${CMAKE_PATH}/bin/ninja | |
export ANDROID_NDK=${ANDROID_SDK_ROOT}/ndk/${{ env.ANDROID_NDK_VERSION }} | |
export ANDROID_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake | |
cd build_retro | |
./android_build.sh | |
- name: Prepare Unsigned APKs/AAB for Distribution | |
if: ${{ matrix.build-type == 'apk'}} | |
run: | | |
export ANDROID_BUILD_TOOLS=$ANDROID_HOME/build-tools/${{ env.ANDROID_BUILD_TOOLS_VERSION }} | |
cp build_android/build/outputs/apk/release/Play-release-unsigned.apk . | |
cp Play-release-unsigned.apk Play-release.apk | |
cp build_android/build/outputs/bundle/release/Play-release.aab . | |
$ANDROID_BUILD_TOOLS/zipalign -c -v 4 Play-release-unsigned.apk | |
- name: Prepare Signed APKs for Distribution | |
if: ${{ matrix.build-type == 'apk' && env.ANDROID_KEYSTORE_PASS != null}} | |
run: | | |
export ANDROID_BUILD_TOOLS=$ANDROID_HOME/build-tools/${{ env.ANDROID_BUILD_TOOLS_VERSION }} | |
$ANDROID_BUILD_TOOLS/apksigner sign --ks installer_android/deploy.keystore --ks-key-alias deploy --ks-pass env:ANDROID_KEYSTORE_PASS --key-pass env:ANDROID_KEYSTORE_PASS Play-release.apk | |
$ANDROID_BUILD_TOOLS/zipalign -c -v 4 Play-release.apk | |
env: | |
ANDROID_KEYSTORE_PASS: ${{ secrets.ANDROID_KEYSTORE_PASS }} | |
- name: Upload a Build Artifact Android APK Signed | |
if: ${{ matrix.build-type == 'apk' && env.ANDROID_KEYSTORE_PASS != null }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Play_Android_Signed | |
path: Play-release.apk | |
env: | |
ANDROID_KEYSTORE_PASS: ${{ secrets.ANDROID_KEYSTORE_PASS }} | |
- name: Upload a Build Artifact Android APK Unsigned | |
if: ${{ matrix.build-type == 'apk' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Play_Android_APK_Unsigned | |
path: Play-release-unsigned.apk | |
- name: Upload a Build Artifact Android libretro | |
if: ${{ matrix.build-type == 'libretro' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Play_Android_libretro | |
path: build_retro/play_libretro_*_android.so | |
- name: Upload APKs/AAB to S3 | |
if: ${{ matrix.build-type == 'apk' && env.AWS_ACCESS_KEY_ID != null}} | |
run: | | |
aws s3 cp Play-release.apk s3://playbuilds/$SHORT_HASH/Play-release.apk --acl public-read | |
aws s3 cp Play-release.aab s3://playbuilds/$SHORT_HASH/Play-release.aab --acl public-read | |
aws s3 cp Play-release-unsigned.apk s3://playbuilds/$SHORT_HASH/Play-release-unsigned.apk --acl public-read | |
env: | |
SHORT_HASH: ${{ steps.short_hash.outputs.VALUE }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: 'us-east-2' | |
- name: Upload libretro Core to S3 | |
if: ${{ matrix.build-type == 'libretro' && env.AWS_ACCESS_KEY_ID != null}} | |
run: | | |
ABI_LIST="arm64-v8a armeabi-v7a x86 x86_64" | |
for ABI in $ABI_LIST | |
do | |
aws s3 cp build_retro/play_libretro_${ABI}_android.so s3://playbuilds/$SHORT_HASH/play_libretro_${ABI}_android.so --acl public-read | |
done | |
env: | |
SHORT_HASH: ${{ steps.short_hash.outputs.VALUE }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: 'us-east-2' |