Skip to content

CHG gradle version #443

CHG gradle version

CHG gradle version #443

Workflow file for this run

name: Nightly build Android
on:
push:
tags:
- 'Nightly'
jobs:
set-revision:
name: set revision
runs-on: ubuntu-20.04
outputs:
output1: ${{ steps.out1.outputs.revision }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: detect revision
run: |
read text < ./src/simutrans/revision.h
revision=${text:17:5}
echo "revision=$revision" >> $GITHUB_ENV
- id: out1
run: echo "revision=$revision" >> $GITHUB_OUTPUT
build:
runs-on: ubuntu-latest
needs: [set-revision]
permissions: write-all
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: 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
cp -v simutrans/src/android/logo_72.png ../src/main/res/mipmap-hdpi/ic_launcher.png
cp -v simutrans/src/android/logo_48.png ../src/main/res/mipmap-mdpi/ic_launcher.png
cp -v simutrans/src/android/logo_96.png ../src/main/res/mipmap-xhdpi/ic_launcher.png
cp -v simutrans/src/android/logo_144.png ../src/main/res/mipmap-xxhdpi/ic_launcher.png
cp -v simutrans/src/android/logo_192.png ../src/main/res/mipmap-xxxhdpi/ic_launcher.png
chmod +755 simutrans/src/android/AndroidPreBuild.sh
chmod +755 simutrans/tools/get_lang_files.sh
chmod +755 simutrans/tools/get_pak.sh
./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 for Android
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/applicationId "com.simutrans"/applicationId "com.simutrans.germany.simutrans"/' /android-sdl/simutrans-android-project/simutrans/build.gradle
sed -i "s/versionCode [0-9]\+/versionCode ${{ needs.set-revision.outputs.output1 }}/" /android-sdl/simutrans-android-project/simutrans/build.gradle
sed -i '/distributionUrl/s/gradle-8.3-all.zip/gradle-8.11.1-all.zip/' /android-sdl/simutrans-android-project/gradle/wrapper/gradle-wrapper.properties
cd /android-sdl/simutrans-android-project
cat simutrans/build.gradle
#cp project/jni/simutrans/src/android/signBundle.sh .
#chmod 555 ./signBundle.sh
#./build.sh -b simutrans
./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
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_r.apk
tag: Nightly
overwrite: true