build: github workflow for android build #2
This file contains hidden or 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 Android APK | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
submodules: false | |
- name: Setup JDK 8 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '8' | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v2 | |
- name: Install Android Build Tools and SDK | |
run: | | |
echo "y" | sdkmanager "build-tools;23.0.1" "platforms;android-23" "extras;android;m2repository" | |
- name: Setup Android NDK | |
run: | | |
wget https://dl.google.com/android/repository/android-ndk-r14b-linux-x86_64.zip | |
chmod a+x android-ndk-r14b-linux-x86_64.zip | |
unzip -qq android-ndk-r14b-linux-x86_64.zip -d $ANDROID_SDK_ROOT/ndk-bundle | |
echo "NDK_ROOT=$ANDROID_SDK_ROOT/ndk-bundle/android-ndk-r14b" >> $GITHUB_ENV | |
echo "$ANDROID_SDK_ROOT/ndk-bundle/android-ndk-r14b" >> $GITHUB_PATH | |
- name: Clone Cocos2d-x repository | |
run: | | |
git clone --branch cocos2d-x-3.14.1 http://github.com/cocos2d/cocos2d-x.git | |
cd cocos2d-x | |
python download-deps.py -r yes | |
git submodule update --init | |
cd tools/cocos2d-console/ | |
python download-bin.py -r yes | |
cd ../../ | |
echo "COCOS_CONSOLE_ROOT=$(pwd)/tools/cocos2d-console/bin" >> $GITHUB_ENV | |
echo "$(pwd)/tools/cocos2d-console/bin" >> $GITHUB_PATH | |
echo "COCOS_TEMPLATES_ROOT=$(pwd)/templates" >> $GITHUB_ENV | |
echo "$(pwd)/templates" >> $GITHUB_PATH | |
cd .. | |
echo "yes Y" | cocos -v | |
- name: Build Android APK | |
run: cocos compile -p android |