Files
notesnook/.github/workflows/android.publish.yml
2024-01-31 18:19:32 +05:00

146 lines
5.3 KiB
YAML

name: Publish @notesnook/android
on: workflow_dispatch
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node
uses: ./.github/actions/setup-node-with-cache
- name: Use specific Java version for the builds
uses: joschi/setup-jdk@v2
with:
java-version: "11"
architecture: "x64"
- name: Install node modules
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') }}
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++
export CCACHE_COMPILERCHECK=content
export CCACHE_DEBUG=true
- 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
- name: CCache Stats Before Build
run: ccache -sv
- name: Build unsigned app bundle
run: yarn release:android:bundle
- name: CCache Stats after build 1
run: ccache -sv
- name: Build unsigned app bundle
run: |
cd apps/mobile/native/android
./gradlew clean
cd ../../../../
yarn release:android:bundle
- name: CCache Stats after build 2
run: ccache -sv
# - name: Sign app bundle for Playstore release
# id: sign_app
# 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: Publish to Playstore
# id: deploy
# uses: r0adkll/upload-google-play@v1.1.1
# with:
# serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
# packageName: com.streetwriters.notesnook
# releaseFiles: ${{steps.sign_app.outputs.signedReleaseFile}}
# track: production
# status: completed
# whatsNewDirectory: apps/mobile/native/android/releasenotes/
# - 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: Create release draft on Github
# uses: softprops/action-gh-release@v1
# with:
# draft: true
# tag_name: ${{ steps.package-version.outputs.current-version}}-android
# name: Notesnook Android v${{ steps.package-version.outputs.current-version}}
# 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