Editor: Updated Russian translation #383
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: Android CI | |
on: | |
push: | |
branches: | |
- master | |
- stable | |
- devel | |
- versus-ci-android | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
working-directory: Engine/android-project | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: Build release-apk | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: Wohlstand/branch-name@v1.0.1-wohl | |
- name: Check if a pull request | |
id: event-check | |
shell: bash | |
run: | | |
if [[ "${BRANCH_NAME}" == *"merge"* ]]; then | |
echo "--- This build is a pull-request ---" | |
echo "is_pull_request=true" >> $GITHUB_OUTPUT; | |
else | |
echo "--- This build is a normal branch build ---" | |
echo "is_pull_request=false" >> $GITHUB_OUTPUT; | |
fi | |
- name: Pull submodules | |
shell: bash | |
run: | | |
git submodule init | |
git submodule update | |
- name: Check for the upload support | |
id: upload-check | |
shell: bash | |
run: | | |
if [[ "${{ secrets.builds_login }}" != '' && \ | |
"${{ secrets.builds_password }}" != '' && \ | |
"${{ secrets.builds_host }}" != '' ]]; then | |
echo "available=true" >> $GITHUB_OUTPUT; | |
else | |
echo "available=false" >> $GITHUB_OUTPUT; | |
fi | |
- name: Check for the upload support | |
id: signing-check | |
shell: bash | |
run: | | |
if [[ "${{ secrets.ANDROID_KEYSTORE }}" != '' && \ | |
"${{ secrets.RELEASE_STORE_PASSWORD }}" != '' && \ | |
"${{ secrets.RELEASE_KEY_PASSWORD }}" != '' && \ | |
"${{ secrets.RELEASE_KEY_ALIAS }}" != '' ]]; | |
then | |
echo "available=true" >> $GITHUB_OUTPUT; | |
else | |
echo "available=false" >> $GITHUB_OUTPUT; | |
fi | |
- name: Install Dependencies | |
shell: bash | |
run: | | |
sudo apt-get update -qq && sudo apt-get install -qq cmake lftp build-essential gcc g++ libc6 libstdc++6 libc6-dev libc6-dev-i386 qttools5-dev-tools | |
# Pull submodules | |
git submodule init | |
git submodule update | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
- uses: nttld/setup-ndk@v1 | |
with: | |
ndk-version: r23c | |
# IMPORTANT NOTE: The SDK r23b is REQUIRED to support Android 4.1, 4.2, and 4.3, and to support non-Neon hardware | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v3 | |
# Without NDK not compile and not normal error message. NDK is required | |
#- name: Install NDK | |
# run: echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;22.1.7171670" --sdk_root=${ANDROID_SDK_ROOT} | |
# Some times is have problems with permissions for ./gradle file. Then uncommit it code | |
# - name: Make gradlew executable | |
# run: chmod +x ./gradlew | |
- name: Output version code | |
run: echo VERSION_CODE=${{ github.run_number }} > ./version.properties | |
- name: Import the signing | |
run: echo "${{ secrets.ANDROID_KEYSTORE }}" | base64 -d > release-key.jks | |
- name: Build with Gradle | |
if: ${{ steps.signing-check.outputs.available == 'true' }} | |
run: ./gradlew assembleReleaseci | |
env: | |
RELEASE_STORE_PASSWORD: ${{ secrets.RELEASE_STORE_PASSWORD }} | |
RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }} | |
RELEASE_KEY_ALIAS: ${{ secrets.RELEASE_KEY_ALIAS }} | |
PIN_ALIAS: ${{ secrets.PIN_ALIAS }} | |
DB_PASS_ALIAS: ${{ secrets.DB_PASS_ALIAS }} | |
- name: Build with Gradle (unsigned) | |
if: ${{ steps.signing-check.outputs.available != 'true' }} | |
run: ./gradlew assembleRelease | |
- name: Rename APK | |
if: ${{ steps.signing-check.outputs.available == 'true' }} | |
shell: bash | |
run: | | |
if [[ "${BRANCH_NAME}" == *"merge"* ]]; then | |
BRANCH_NAME_RES="pull-request" | |
echo "-- Pull-request detected!" | |
else | |
BRANCH_NAME_RES=${BRANCH_NAME} | |
fi | |
mv moondust/build/outputs/apk/releaseci/moondust-releaseci.apk moondust-engine-android-${BRANCH_NAME_RES}.apk | |
- name: Rename APK (unsigned) | |
if: ${{ steps.signing-check.outputs.available != 'true' }} | |
shell: bash | |
run: | | |
if [[ "${BRANCH_NAME}" == *"merge"* ]]; then | |
BRANCH_NAME_RES="pull-request" | |
echo "-- Pull-request detected!" | |
else | |
BRANCH_NAME_RES=${BRANCH_NAME} | |
fi | |
mv moondust/build/outputs/apk/release/moondust-release-unsigned.apk moondust-engine-android-${BRANCH_NAME_RES}.apk | |
- name: Upload APK | |
if: success() && ${{ steps.signing-check.outputs.available == 'true' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: moondust-engine-android-${BRANCH_NAME_RES} | |
path: Engine/android-project/moondust-engine-android-*.apk | |
- name: Upload APK (unsigned) | |
if: success() && ${{ steps.signing-check.outputs.available != 'true' }} | |
uses: actions/upload-artifact@v4 | |
continue-on-error: true | |
with: | |
name: moondust-engine-android-${BRANCH_NAME_RES}-unsigned | |
path: Engine/android-project/moondust-engine-android-*.apk | |
- name: Deploy to builds.wohlsoft.ru | |
if: success() && github.event_name != 'pull_request' && steps.event-check.outputs.is_pull_request == 'false' && steps.upload-check.outputs.available == 'true' | |
shell: bash | |
run: | | |
if [[ "${BRANCH_NAME}" == *"merge"* ]]; then | |
BRANCH_NAME_RES="pull-request" | |
echo "-- Pull-request detected!" | |
else | |
BRANCH_NAME_RES=${BRANCH_NAME} | |
fi | |
UPLOAD_LIST="set ssl:verify-certificate no;" | |
UPLOAD_LIST="${UPLOAD_LIST} put -O "www/android/" ./moondust-engine-android-${BRANCH_NAME_RES}.apk;" | |
lftp -e "${UPLOAD_LIST} exit" -u ${{ secrets.builds_login }},${{ secrets.builds_password }} ${{ secrets.builds_host }} | |
- name: List Build Directory | |
if: always() | |
shell: bash | |
run: | | |
git status | |
ls -lR . |