github: Add a workflow for making a release out of the last successfu… #199
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 | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build-native-libs: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target: [ | |
aarch64-linux-android, | |
armv7-linux-androideabi, | |
x86_64-linux-android, | |
i686-linux-android, | |
] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Add Android target to Rust | |
run: rustup target add ${{ matrix.target }} | |
- name: Update Rust | |
run: rustup update | |
- name: Install cargo-apk | |
run: cargo install cargo-apk | |
- name: Build native libs | |
run: | | |
unset ANDROID_SDK_ROOT # Deprecated, will cause an error if left set. | |
cd native | |
cargo apk -- build --release --target ${{ matrix.target }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: native-lib-${{ matrix.target }} | |
path: native/target/${{ matrix.target }}/release/libruffle_android.so | |
build-apks: | |
needs: build-native-libs | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: # no name set, so all artifacts are downloaded | |
path: native-libs | |
- name: Copy native libs | |
run: | | |
mkdir app/ruffle/src/main/jniLibs | |
mkdir app/ruffle/src/main/jniLibs/arm64-v8a | |
cp native-libs/native-lib-aarch64-linux-android/libruffle_android.so app/ruffle/src/main/jniLibs/arm64-v8a/ | |
mkdir app/ruffle/src/main/jniLibs/armeabi-v7a | |
cp native-libs/native-lib-armv7-linux-androideabi/libruffle_android.so app/ruffle/src/main/jniLibs/armeabi-v7a/ | |
mkdir app/ruffle/src/main/jniLibs/x86_64 | |
cp native-libs/native-lib-x86_64-linux-android/libruffle_android.so app/ruffle/src/main/jniLibs/x86_64/ | |
mkdir app/ruffle/src/main/jniLibs/x86 | |
cp native-libs/native-lib-i686-linux-android/libruffle_android.so app/ruffle/src/main/jniLibs/x86/ | |
- name: Set up Java 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Build debug APK | |
# The native libs are always built in release mode, this is left in here just so if | |
# something with the signing procedure below goes haywire, we still have something. | |
run: | | |
cd app | |
./gradlew assembleDebug # The release version doesn't work without signing | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ruffle-debug-apks | |
path: app/ruffle/build/outputs/apk/debug/*.apk | |
- name: Decode keystore | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
env: | |
ENCODED_STRING: ${{ secrets.KEYSTORE }} | |
run: | | |
echo $ENCODED_STRING | base64 -di > app/ruffle/androidkey.jks | |
- name: Build release APK | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
run: | | |
cd app | |
./gradlew assembleRelease | |
env: | |
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} | |
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} | |
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }} | |
- uses: actions/upload-artifact@v3 | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
with: | |
name: ruffle-release-apks | |
path: app/ruffle/build/outputs/apk/release/*.apk | |