Skip to content

ADD: (Yona-TYT) more parameters to is_work_allowed_here #703

ADD: (Yona-TYT) more parameters to is_work_allowed_here

ADD: (Yona-TYT) more parameters to is_work_allowed_here #703

name: Nightly build Android
on:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
path: 'gh-clone/simutrans'
- name: Install dependencies
run: |
sudo dpkg --add-architecture i386
sudo apt-get -yqq update
sudo apt-get -ym install curl expect git libc6:i386 libgcc1:i386 libncurses5:i386 libstdc++6:i386 zlib1g:i386 openjdk-17-jdk wget unzip vim make subversion zip
- name: Setup Android SDK environment variables
run: |
echo "ANDROID_HOME=/opt/android-sdk-linux" >> $GITHUB_ENV
echo "ANDROID_SDK_HOME=/opt/android-sdk-linux" >> $GITHUB_ENV
echo "ANDROID_SDK_ROOT=/opt/android-sdk-linux" >> $GITHUB_ENV
echo "ANDROID_SDK=/opt/android-sdk-linux" >> $GITHUB_ENV
echo "JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64" >> $GITHUB_ENV
- name: Create working directory for next steps
run: |
sudo mkdir /opt/android-sdk-linux
sudo mkdir /android-sdl
sudo chown -R runner /opt/android-sdk-linux
sudo chgrp -R docker /opt/android-sdk-linux
sudo chown -R runner /android-sdl
sudo chgrp -R docker /android-sdl
- name: Install Android SDK tools
working-directory: /opt/android-sdk-linux
run: |
wget https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip
unzip commandlinetools-linux-7583922_latest.zip
rm commandlinetools-linux-7583922_latest.zip
mv cmdline-tools latest
mkdir cmdline-tools
mv latest cmdline-tools/latest
echo "$ANDROID_HOME/cmdline-tools/latest/bin" >> $GITHUB_PATH
- name: Install Android SDK dependencies
working-directory: /opt/android-sdk-linux
run: |
yes | sdkmanager --licenses
yes | sdkmanager --install "platform-tools"
echo "$ANDROID_HOME/platform-tools" >> $GITHUB_PATH
yes | sdkmanager --install "build-tools;34.0.0"
echo "$ANDROID_HOME/build-tools/34.0.0" >> $GITHUB_PATH
yes | sdkmanager --install "cmake;3.22.1"
echo "$ANDROID_HOME/cmake/3.22.1/bin" >> $GITHUB_PATH
yes | sdkmanager --install "ndk;25.1.8937393"
echo "$ANDROID_HOME/ndk/25.1.8937393" >> $GITHUB_PATH
echo "$ANDROID_HOME/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/" >> $GITHUB_PATH
ln -s llvm-objdump ${ANDROID_HOME}/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/objdump
- name: Install keystore for Android APK signing
run: |
mkdir /home/runner/.android/
keytool -genkey -v -keystore /home/runner/.android/debug.keystore -alias androiddebugkey -keyalg RSA -keysize 2048 -validity 10000 -keypass android -storepass android -dname "cn=example.com,ou=exampleou,dc=example,dc=com"
- name: Set up android project
working-directory: /android-sdl
run: |
git clone --depth 1 https://github.com/simutrans/simutrans-android-project
cd simutrans-android-project
git submodule init
git submodule update --depth 1
cp -r $GITHUB_WORKSPACE/gh-clone/simutrans simutrans/jni/simutrans
cp -r simutrans/jni/SDL/android-project/app/src/main/java simutrans/src/main
cd simutrans/jni
./simutrans/src/android/AndroidPreBuild.sh
cp -rf simutrans/simutrans/. ../src/main/assets
- name: Build libraries
working-directory: /android-sdl/simutrans-android-project/simutrans/jni
run: |
./build_libraries.sh
# Fluidsynth is a PITA to build; using the prebuilt release instead
wget https://github.com/FluidSynth/fluidsynth/releases/download/v2.3.5/fluidsynth-2.3.5-android24.zip
unzip fluidsynth-*.zip -d fluidsynth
- name: Build Simutrans
env:
SIGNING_KEYSTORE: /android-sdl/simutrans-android-project/simutrans/jni/simutrans/src/android/Simutrans-upload.keystore
SIGNING_KEY_ALIAS: ${{ secrets.ANDROID_UPLOAD_KEYSTORE_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.ANDROID_UPLOAD_KEYSTORE_PASS }}
SIGNING_STORE_PASSWORD: ${{ secrets.ANDROID_UPLOAD_KEYSTORE_PASS }}
working-directory: gh-clone/simutrans
run: |
echo "action_state=yellow" >> $GITHUB_ENV
sed -i "s/versionCode [0-9]\+/versionCode $(./tools/get_revision.sh)/" /android-sdl/simutrans-android-project/simutrans/build.gradle
cd /android-sdl/simutrans-android-project
cat simutrans/build.gradle
./gradlew assembleRelease
./gradlew bundleRelease
cd /android-sdl/simutrans-android-project/simutrans/build/outputs/bundle/release
jarsigner -verbose -sigalg SHA256withRSA -digestalg SHA-256 -keystore $SIGNING_KEYSTORE -storepass $SIGNING_STORE_PASSWORD simutrans-release.aab $SIGNING_KEY_ALIAS
mkdir whatsNewDirectory
echo `cd $GITHUB_WORKSPACE/gh-clone/simutrans && git log --pretty=format:'%s' -1` > whatsNewDirectory/whatsnew-en-US
- name: Update binaries of Nightly Release aab
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: /android-sdl/simutrans-android-project/simutrans/build/outputs/bundle/release/simutrans-release.aab
asset_name: simuandroid-nightly.aab
tag: Nightly
overwrite: true
- name: Update binaries of Nightly Release apk
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: /android-sdl/simutrans-android-project/simutrans/build/outputs/apk/release/simutrans-release-unsigned.apk
asset_name: simuandroid-nightly.apk
tag: Nightly
overwrite: true
- name: Release Beta on Google Play Store
uses: r0adkll/upload-google-play@v1
if: github.repository == 'simutrans/simutrans'
with:
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
packageName: com.simutrans
releaseFiles: /android-sdl/simutrans-android-project/simutrans/build/outputs/bundle/release/simutrans-release.aab
track: beta
status: completed
whatsNewDirectory: /android-sdl/simutrans-android-project/simutrans/build/outputs/bundle/release/whatsNewDirectory