From f808abc2646cf7cc6b4cbf93a61ec48d68114b92 Mon Sep 17 00:00:00 2001 From: AirLi1507 <167706999+AirLi1507@users.noreply.github.com> Date: Sat, 23 Nov 2024 13:50:45 +0000 Subject: [PATCH] Create android-ci.yml --- .github/workflows/android-ci.yml | 56 ++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/android-ci.yml diff --git a/.github/workflows/android-ci.yml b/.github/workflows/android-ci.yml new file mode 100644 index 000000000..c13b4757a --- /dev/null +++ b/.github/workflows/android-ci.yml @@ -0,0 +1,56 @@ +name: Android CI + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + cache: gradle + + - name: Install Android SDK and NDK + run: | + mkdir /home/runner/android && cd /home/runner/android + + sudo apt install -y unzip + wget https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip + unzip commandlinetools-linux-11076708_latest.zip + export PATH=$PATH:/home/runner/android/cmdline-tools/bin/ + + yes | sdkmanager --sdk_root=/home/runner/android "platforms;android-34" "build-tools;34.0.0" "ndk;26.2.11394342" + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Update submodules + run: git submodule update --init --recursive + + - name: Create local.properties + run: echo "ndk.dir=/home/runner/android/ndk/26.2.11394342" > local.properties + + - name: Build with Gradle + run: | + ./gradlew assembleNonRootRelease + + - name: Sign APK + run: | + keytool -genkey -v -keystore my-release-key.keystore -alias temp_key -keyalg RSA -keysize 2048 -validity 10000 -storepass password -keypass password -dname "CN=GitHubActionsTemporaryKey" + /home/runner/android/build-tools/34.0.0/apksigner sign --ks my-release-key.keystore --ks-key-alias temp_key --ks-pass pass:password --key-pass pass:password --out app-nonRoot-release-signed.apk app/build/outputs/apk/nonRoot/release/app-nonRoot-release-unsigned.apk + + - name: Upload APK + uses: actions/upload-artifact@v4.3.1 + with: + name: Moonlight APK + path: app-nonRoot-release-signed.apk