From d7092fbeb5fc0fbda7077a94af230691881b6627 Mon Sep 17 00:00:00 2001 From: Andrii Danylchenko Date: Sat, 15 Apr 2023 11:47:24 +0300 Subject: [PATCH] Android: building aab for release --- .github/workflows/github.yml | 114 +++++++++++++++++- CI/android/android-release.jks | Bin 0 -> 2241 bytes ...ing.properties => dailySigning.properties} | 0 CI/android/releaseSigning.properties | 2 + android/vcmi-app/build.gradle | 45 ++++--- 5 files changed, 144 insertions(+), 17 deletions(-) create mode 100644 CI/android/android-release.jks rename CI/android/{signing.properties => dailySigning.properties} (100%) create mode 100644 CI/android/releaseSigning.properties diff --git a/.github/workflows/github.yml b/.github/workflows/github.yml index 42a7c9ef4..4b1a4d876 100644 --- a/.github/workflows/github.yml +++ b/.github/workflows/github.yml @@ -130,7 +130,7 @@ jobs: preset: android-conan-ninja-release conan_profile: android-64 conan_options: --conf tools.android:ndk_path=$ANDROID_NDK_ROOT - artifact_platform: aarch64-v8a + artifact_platform: arm64-v8a runs-on: ${{ matrix.os }} defaults: run: @@ -225,6 +225,7 @@ jobs: name: ${{ env.VCMI_PACKAGE_FILE_NAME }} - ${{ matrix.platform }} path: | ${{github.workspace}}/out/build/${{matrix.preset}}/${{ env.VCMI_PACKAGE_FILE_NAME }}.${{ matrix.extension }} + - name: Android artifacts if: ${{ startsWith(matrix.platform, 'android') }} uses: actions/upload-artifact@v3 @@ -233,6 +234,14 @@ jobs: path: | ${{ env.ANDROID_APK_PATH }} + - name: Android JNI ${{matrix.platform}} + if: ${{ startsWith(matrix.platform, 'android') && github.ref == 'refs/heads/master' }} + uses: actions/upload-artifact@v3 + with: + name: Android JNI ${{matrix.platform}} + path: | + ${{ github.workspace }}/android/vcmi-app/src/main/jniLibs + - name: Upload build if: ${{ (matrix.pack == 1 || startsWith(matrix.platform, 'android')) && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/beta' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/features/')) && matrix.platform != 'msvc' }} continue-on-error: true @@ -254,3 +263,106 @@ jobs: env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} if: always() + + # copy-pasted mostly + bundle_release: + + needs: build + if: always() && github.ref == 'refs/heads/master' + strategy: + matrix: + include: + - platform: android-32 + os: ubuntu-22.04 + extension: aab + preset: android-conan-ninja-release + conan_profile: android-32 + conan_options: --conf tools.android:ndk_path=$ANDROID_NDK_ROOT + artifact_platform: aab + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Dependencies + run: source '${{github.workspace}}/CI/${{matrix.platform}}/before_install.sh' + env: + VCMI_BUILD_PLATFORM: x64 + + - uses: actions/setup-python@v4 + if: "${{ matrix.conan_profile != '' }}" + with: + python-version: '3.10' + - name: Conan setup + if: "${{ matrix.conan_profile != '' }}" + run: | + pip3 install 'conan<2.0' + conan profile new default --detect + conan install . \ + --install-folder=conan-generated \ + --no-imports \ + --build=never \ + --profile:build=default \ + --profile:host=CI/conan/${{ matrix.conan_profile }} \ + ${{ matrix.conan_options }} + env: + GENERATE_ONLY_BUILT_CONFIG: 1 + + - name: Git branch name + id: git-branch-name + uses: EthanSK/git-branch-name-action@v1 + + - name: Build Number + run: | + source '${{github.workspace}}/CI/get_package_name.sh' + if [ '${{ matrix.artifact_platform }}' ]; then + VCMI_PACKAGE_FILE_NAME+="-${{ matrix.artifact_platform }}" + fi + echo VCMI_PACKAGE_FILE_NAME="$VCMI_PACKAGE_FILE_NAME" >> $GITHUB_ENV + echo VCMI_PACKAGE_NAME_SUFFIX="$VCMI_PACKAGE_NAME_SUFFIX" >> $GITHUB_ENV + echo VCMI_PACKAGE_GITVERSION="$VCMI_PACKAGE_GITVERSION" >> $GITHUB_ENV + env: + PULL_REQUEST: ${{ github.event.pull_request.number }} + + - name: CMake Preset + run: | + cmake --preset ${{ matrix.preset }} + + - name: Build Preset + run: | + cmake --build --preset ${{matrix.preset}} + + - name: Download libs x64 + uses: actions/download-artifact@v3 + with: + name: Android JNI android-64 + path: ${{ github.workspace }}/android/vcmi-app/src/main/jniLibs/ + + - name: Create android package + run: | + cd android + ./gradlew bundleRelease --info + echo ANDROID_APK_PATH="$(ls ${{ github.workspace }}/android/vcmi-app/build/outputs/bundle/release/*.aab)" >> $GITHUB_ENV + env: + ANDROID_STORE_PASSWORD: ${{ secrets.ANDROID_STORE_PASSWORD }} + ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }} + + - name: Android artifacts + uses: actions/upload-artifact@v3 + with: + name: ${{ env.VCMI_PACKAGE_FILE_NAME }} + path: | + ${{ env.ANDROID_APK_PATH }} + + - uses: act10ns/slack@v1 + with: + status: ${{ job.status }} + channel: '#notifications' + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + if: always() diff --git a/CI/android/android-release.jks b/CI/android/android-release.jks new file mode 100644 index 0000000000000000000000000000000000000000..7ff98871cf7c1f1f130241aac496f29137efc6cf GIT binary patch literal 2241 zcmchYc{J1uAI9f53uBG4l%>_*_t zeUo6Ko<#+LU;vT`-9rj;@v3nFP(T$d3;-|?ln9-VmG9P)Z73YoaTqi@VC@x7dek^a z(&01Ija3Qgj7-x-qI(k9k(bkL(R7jlm~abY0iSp}VcF2{z2eanXnLah+vXK7OcKZ2 zxI3NY9O^7ntI@$AT(B1{)D&f&LS*)Ju|qwmqbIW6pB(fa46xD?h4uvlF;!vSwyD0h z9}^$9pxR%Zn3<+b1$(!~=xJ?62u@skQko|9on(rezd!0}krcsLa7gwqKaM*UJgQQ_ zA~(=!?G*)zS#de_hXyomI>MLyhn9P+u=n-n3wR3*>nu#9k0FFc`*&0AH}LsF&xo2u zH>A&3&Mho9=)Zn%{aqJshG<6N6!ENrWQlq%9l32aW{b#j7DOkc-ChAwOiy@*iwu!G zke~=ywOcD*x{;Wq&999yw0S$%l|T2J&9NX@nO+>t7-&6Qd|X_AVp`{s>ET>#`$EGwU#s)e?cu>-!34-1wuu{_VNPb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Yc-gWWF$>zH&W@>H{!IIvqb98aTZxNk0VEMVF;WWN$%;M>#?K=m1 zFB@6rCAY6*N7eYSHU%7sjpr2um#VKcKHm~eN_^Rs*wRYP3!Z91SY9xsf&E1*!%~elI~Ri literal 0 HcmV?d00001 diff --git a/CI/android/signing.properties b/CI/android/dailySigning.properties similarity index 100% rename from CI/android/signing.properties rename to CI/android/dailySigning.properties diff --git a/CI/android/releaseSigning.properties b/CI/android/releaseSigning.properties new file mode 100644 index 000000000..28d2af07c --- /dev/null +++ b/CI/android/releaseSigning.properties @@ -0,0 +1,2 @@ +STORE_FILE=android-release.jks +KEY_ALIAS=vcmi \ No newline at end of file diff --git a/android/vcmi-app/build.gradle b/android/vcmi-app/build.gradle index 4933f7b8f..7fb4c6ff6 100644 --- a/android/vcmi-app/build.gradle +++ b/android/vcmi-app/build.gradle @@ -10,14 +10,16 @@ android { applicationId "is.xyz.vcmi" minSdk 19 targetSdk 31 - versionCode 1103 - versionName "1.1" + versionCode 1200 + versionName "1.2" setProperty("archivesBaseName", "vcmi") } signingConfigs { releaseSigning - LoadSigningConfig() + dailySigning + LoadSigningConfig("releaseSigning") + LoadSigningConfig("dailySigning") } buildTypes { @@ -46,6 +48,7 @@ android { daily { initWith release applicationIdSuffix '.daily' + signingConfig signingConfigs.dailySigning manifestPlaceholders = [ applicationLabel: 'VCMI daily', ] @@ -118,38 +121,48 @@ def ResolveGitInfo() { CommandOutput("git", ["describe", "--match=", "--always", "--abbrev=7"], ".") } -def SigningPropertiesPath(final basePath) { - return file("${basePath}/signing.properties") +def SigningPropertiesPath(final basePath, final signingConfigKey) { + return file("${basePath}/${signingConfigKey}.properties") } def SigningKeystorePath(final basePath, final keystoreFileName) { return file("${basePath}/${keystoreFileName}") } -def LoadSigningConfig() { +def LoadSigningConfig(final signingConfigKey) { final def projectRoot = "${project.projectDir}/../../CI/android" final def props = new Properties() - final def propFile = SigningPropertiesPath(projectRoot) + final def propFile = SigningPropertiesPath(projectRoot, signingConfigKey) + + def signingConfig = android.signingConfigs.getAt(signingConfigKey) + if (propFile.canRead()) { props.load(new FileInputStream(propFile)) if (props != null && props.containsKey('STORE_FILE') - && props.containsKey('STORE_PASSWORD') - && props.containsKey('KEY_ALIAS') - && props.containsKey('KEY_PASSWORD')) { + && props.containsKey('KEY_ALIAS')) { - android.signingConfigs.releaseSigning.storeFile = SigningKeystorePath(projectRoot, props['STORE_FILE']) - android.signingConfigs.releaseSigning.storePassword = props['STORE_PASSWORD'] - android.signingConfigs.releaseSigning.keyAlias = props['KEY_ALIAS'] - android.signingConfigs.releaseSigning.keyPassword = props['KEY_PASSWORD'] + signingConfig.storeFile = SigningKeystorePath(projectRoot, props['STORE_FILE']) + signingConfig.storePassword = props['STORE_PASSWORD'] + signingConfig.keyAlias = props['KEY_ALIAS'] + + if(props.containsKey('STORE_PASSWORD')) + signingConfig.storePassword = props['STORE_PASSWORD'] + else + signingConfig.storePassword = System.getenv("ANDROID_STORE_PASSWORD") + + if(props.containsKey('KEY_PASSWORD')) + signingConfig.keyPassword = props['KEY_PASSWORD'] + else + signingConfig.keyPassword = System.getenv("ANDROID_KEY_PASSWORD") } else { println("Some props from signing file are missing") - android.buildTypes.release.signingConfig = null + android.signingConfigs.putAt(signingConfigKey, null) } } else { println("file with signing properties is missing") - android.buildTypes.release.signingConfig = null + android.signingConfigs.putAt(signingConfigKey, null) } }