From 5c8c80622825848cab339ebabc1e166cb19e9cbe Mon Sep 17 00:00:00 2001 From: Ammar Ahmed <40239442+ammarahm-ed@users.noreply.github.com> Date: Fri, 2 Feb 2024 15:11:54 +0500 Subject: [PATCH] Update android.publish.internal.yml Signed-off-by: Ammar Ahmed <40239442+ammarahm-ed@users.noreply.github.com> --- .../workflows/android.publish.internal.yml | 113 +++++++++++++++++- 1 file changed, 107 insertions(+), 6 deletions(-) diff --git a/.github/workflows/android.publish.internal.yml b/.github/workflows/android.publish.internal.yml index fee6f155d..744f66500 100644 --- a/.github/workflows/android.publish.internal.yml +++ b/.github/workflows/android.publish.internal.yml @@ -1,4 +1,4 @@ -name: Publish @notesnook/android-internal +name: Publish @notesnook/android on: workflow_dispatch @@ -6,6 +6,11 @@ jobs: build: runs-on: ubuntu-latest timeout-minutes: 40 + env: + CMAKE_C_COMPILER_LAUNCHER: ccache + CMAKE_CXX_COMPILER_LAUNCHER: ccache + NDK_CCACHE: ccache + USE_CCACHE: 1 steps: - name: Checkout @@ -24,30 +29,126 @@ jobs: run: | npm ci --ignore-scripts --prefer-offline --no-audit npm run bootstrap -- --scope=mobile - + - name: Make Gradlew Executable run: cd apps/mobile/native/android && chmod +x ./gradlew + - name: Install CCache + uses: hendrikmuhs/ccache-action@v1.2.11 + with: + key: ${{ runner.os }}-ccache-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + max-size: 1500M + restore-keys: | + ${{ runner.os }}-ccache- + + - name: Setup CCache + run: | + ln -s $(which ccache) /usr/local/bin/gcc + ln -s $(which ccache) /usr/local/bin/g++ + ln -s $(which ccache) /usr/local/bin/cc + ln -s $(which ccache) /usr/local/bin/c++ + ln -s $(which ccache) /usr/local/bin/clang + ln -s $(which ccache) /usr/local/bin/clang++ + ccache --set-config=base_dir=$PWD + ccache --set-config=inode_cache=true + ccache --set-config=compiler_check=content + ccache --set-config=depend_mode=true + ccache --set-config=file_clone=true + ccache --set-config=sloppiness=clang_index_store,file_stat_matches,include_file_ctime,include_file_mtime,ivfsoverlay,pch_defines,modules,system_headers,time_macros + ccache -p + + - name: Cache gradle + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + + - name: Patch CPP Projects to use CCache + run: | + sed -i -e 's/arguments/arguments "-DCMAKE_CXX_COMPILER_LAUNCHER=ccache",/g' apps/mobile/node_modules/react-native-mmkv-storage/android/build.gradle + sed -i -e 's/arguments/arguments "-DCMAKE_CXX_COMPILER_LAUNCHER=ccache",/g' apps/mobile/node_modules/react-native-reanimated/android/build.gradle + sed -i -e 's/defaultConfig {/ndkVersion safeExtGet('ndkVersion', "25.2.9519653")\n defaultConfig {/g' apps/mobile/node_modules/react-native-reanimated//android/build.gradle + sed -i -e 's/defaultConfig {/ndkVersion safeExtGet('ndkVersion', "25.2.9519653")\n defaultConfig {/g' apps/mobile/node_modules/react-native-mmkv-storage/android/build.gradle + + - name: CCache Stats Before Build + run: ccache -sv + - name: Build unsigned app bundle run: yarn release:android:bundle + - name: CCache Stats after build + run: ccache -sv + - name: Sign app bundle for Playstore release id: sign_app - uses: r0adkll/sign-android-release@v1 + uses: r0adkll/sign-android-release@master with: releaseDirectory: apps/mobile/native/android/app/build/outputs/bundle/release signingKeyBase64: ${{ secrets.SIGNING_KEY }} alias: ${{ secrets.ALIAS }} keyStorePassword: ${{ secrets.KEY_PASSWORD }} keyPassword: ${{ secrets.KEY_PASSWORD }} + env: + BUILD_TOOLS_VERSION: "33.0.0" + + - name: Build apks for Github release + run: yarn release:android + + - name: Sign apk files + id: sign_apk + uses: r0adkll/sign-android-release@master + with: + releaseDirectory: apps/mobile/native/android/app/build/outputs/apk/release + signingKeyBase64: ${{ secrets.PUBLIC_SIGNING_KEY }} + alias: ${{ secrets.PUBLIC_ALIAS }} + keyStorePassword: ${{ secrets.PUBLIC_KEY_PASSWORD }} + keyPassword: ${{ secrets.PUBLIC_KEY_PASSWORD }} + env: + BUILD_TOOLS_VERSION: "33.0.0" + + - name: Rename apk files + run: | + cd apps/mobile/native/android/app/build/outputs/apk/release/ + mv app-arm64-v8a-release-unsigned-signed.apk notesnook-arm64-v8a.apk + mv app-armeabi-v7a-release-unsigned-signed.apk notesnook-armeabi-v7a.apk + mv app-x86-release-unsigned-signed.apk notesnook-x86.apk + mv app-x86_64-release-unsigned-signed.apk notesnook-x86_64.apk + + - name: Get app version + id: package-version + uses: martinbeentjes/npm-get-version-action@master + with: + path: apps/mobile - name: Publish to Playstore id: deploy - uses: r0adkll/upload-google-play@v1 + uses: r0adkll/upload-google-play@v1.1.1 with: serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }} packageName: com.streetwriters.notesnook - releaseFile: ${{steps.sign_app.outputs.signedReleaseFile}} - track: internal + releaseFiles: ${{steps.sign_app.outputs.signedReleaseFile}} + track: alpha status: completed whatsNewDirectory: apps/mobile/native/android/releasenotes/ + + - name: Create release draft on Github + uses: softprops/action-gh-release@v1 + with: + draft: true + tag_name: ${{ steps.package-version.outputs.current-version}}-beta-android + name: Notesnook Android v${{ steps.package-version.outputs.current-version}} Beta + repository: streetwriters/notesnook + token: ${{ secrets.GITHUB_TOKEN }} + files: | + apps/mobile/native/android/app/build/outputs/apk/release/notesnook-arm64-v8a.apk + apps/mobile/native/android/app/build/outputs/apk/release/notesnook-armeabi-v7a.apk + apps/mobile/native/android/app/build/outputs/apk/release/notesnook-x86.apk + apps/mobile/native/android/app/build/outputs/apk/release/notesnook-x86_64.apk + + - name: Upload signed aab to Github + uses: actions/upload-artifact@v2 + with: + name: Notesnook.aab + path: ${{steps.sign_app.outputs.signedReleaseFile}}