Rework for Android builds/workflows #1126
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
# SuperTux | |
# Copyright (C) 2021-2021 Sergii Pylypenko <[email protected]> | |
# | |
# This program is free software; you can redistribute it and/or | |
# modify it under the terms of the GNU General Public License | |
# as published by the Free Software Foundation; either version 3 | |
# of the License, or (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. | |
# | |
# You should have received a copy of the GNU General Public License | |
# along with this program; if not, write to the Free Software | |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
name: Android | |
on: | |
workflow_dispatch: | |
inputs: {} | |
push: | |
branches: | |
- master | |
tags: | |
- '*' | |
pull_request: {} | |
jobs: | |
build-android: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set script permissions | |
working-directory: ./.github | |
run: chmod +x ./scripts/*.sh | |
- name: Prepare SDL Android project | |
run: | | |
./.github/scripts/clone_dependency.sh libsdl-org/SDL release-2.26.5 | |
mv ./SDL/android-project/ ./build.android | |
mv ./SDL/ ./build.android/app/jni/SDL | |
- name: Clone dependencies | |
working-directory: build.android/app/jni | |
run: | | |
../../../.github/scripts/clone_dependency.sh libsdl-org/SDL_image release-2.6.3 | |
../../../.github/scripts/clone_dependency.sh libsdl-org/SDL_ttf release-2.20.2 | |
../../../.github/scripts/clone_dependency.sh curl/curl curl-8_0_1 | |
../../../.github/scripts/clone_dependency.sh glennrp/libpng v1.6.39 | |
../../../.github/scripts/clone_dependency.sh fmtlib/fmt 9.1.0 | |
../../../.github/scripts/clone_dependency.sh g-truc/glm 0.9.9.8 | |
../../../.github/scripts/clone_dependency.sh xiph/vorbis v1.3.7 | |
../../../.github/scripts/clone_dependency.sh xiph/ogg v1.3.5 | |
../../../.github/scripts/clone_dependency.sh kcat/openal-soft 1.23.1 | |
../../../.github/scripts/clone_dependency.sh janbar/openssl-cmake master | |
../../../.github/scripts/clone_dependency.sh SuperTux/physfs master | |
../../../.github/scripts/clone_dependency.sh driedfruit/SDL_SavePNG master | |
../../../.github/scripts/clone_dependency.sh SuperTux/sexp-cpp master | |
../../../.github/scripts/clone_dependency.sh albertodemichelis/squirrel v3.2 | |
../../../.github/scripts/clone_dependency.sh SuperTux/tinygettext master | |
ln -s ../../../ supertux | |
- name: Copy SuperTux Android project files | |
run: cp -r -f ./mk/android/* ./build.android/ | |
- name: Package data with APK | |
working-directory: data | |
run: | | |
mkdir ../build.android/app/src/main/assets | |
zip -r ../build.android/app/src/main/assets/data.zip . | |
- name: Upload data zip | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "Data zip" | |
path: "build.android/app/src/main/assets/data.zip" | |
- name: Set up JDK 20 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 20 | |
cache: 'gradle' | |
- name: Setup Android enviroment | |
uses: android-actions/setup-android@v2 | |
with: | |
packages: | | |
platforms;android-33 | |
ndk;25.2.9519653 | |
build-tools;33.0.2 | |
- name: Make gradlew executable | |
working-directory: build.android | |
run: chmod +x ./gradlew | |
- name: Build APK | |
working-directory: build.android | |
run: ./gradlew assembleRelease --info | |
- name: Upload unsigned APK | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "Unsigned APK" | |
path: "build.android/app/build/outputs/apk/release/app-release-unsigned.apk" | |
- name: Sign APK | |
working-directory: build.android/app/build/outputs/apk/release | |
run: | | |
# removing possible confusion | |
cp ./app-release-unsigned.apk ./app-release.apk | |
keytool -genkey -v \ | |
-keystore supertux.keystore -alias supertux \ | |
-storepass supertux \ | |
-dname "cn=MatusGuy, ou=Contributor, O=SuperTux Team, L=Antarctica, ST=Antarctica, C=aq" \ | |
-keyalg RSA -keysize 2048 -validity 10000 | |
$ANDROID_SDK_ROOT/build-tools/33.0.2/apksigner sign \ | |
--ks supertux.keystore --ks-pass pass:supertux \ | |
./app-release.apk | |
- name: Upload signed APK | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "Signed APK" | |
path: "build.android/app/build/outputs/apk/release/app-release.apk" |