diff --git a/.gitignore b/.gitignore index fd39e4f6..012766ba 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ src/main/assets/index.android.bundle.meta *.log .vagrant +lbry-android.keystore +.gitsecret/keys/random_seed diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..8fd6e174 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,57 @@ +stages: + - build + - deploy + - release + +build apk: + stage: build + image: lbry/android-base:latest + before_script: + - export BUILD_VERSION=$(cat $CI_PROJECT_DIR/src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+') + artifacts: + paths: + - bin/browser-*-release.apk + script: + - export PATH=/usr/bin:$PATH + - echo "$PGP_PRIVATE_KEY" | gpg --batch --import + - cd app + - npm install + - cd .. + - wget -q 'https://eu.crystax.net/download/crystax-ndk-10.3.2-linux-x86_64.tar.xz' -P ~/.buildozer/android/ + - tar -xf ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz -C ~/.buildozer/android/ + - rm -rf ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9 + - ln -s ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21 ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9 + - cp -f $CI_PROJECT_DIR/scripts/build-target-python.sh ~/.buildozer/android/crystax-ndk-10.3.2/build/tools/build-target-python.sh + - rm ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz + - git secret reveal + - mv buildozer.spec.travis buildozer.spec + - "./release.sh | grep -Fv -e 'working:' -e 'copy' -e 'Compiling' --line-buffered" + - cp $CI_PROJECT_DIR/bin/browser-$BUILD_VERSION-release.apk /dev/null + +deploy build.lbry.io: + image: python:latest + stage: deploy + dependencies: + - build apk + before_script: + - pip install awscli + - export BUILD_VERSION=$(cat $CI_PROJECT_DIR/src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+') + - export BUILD_APK_FILENAME=browser-$BUILD_VERSION-release.apk + script: + - aws s3 cp bin/$BUILD_APK_FILENAME s3://build.lbry.io/android/build-${CI_JOB_ID}_commit-${CI_COMMIT_SHA:0:7}/$BUILD_APK_FILENAME + - aws s3 cp bin/$BUILD_APK_FILENAME s3://build.lbry.io/android/push.apk + +release apk: + image: python:latest + stage: release + only: + - tags + dependencies: + - build apk + before_script: + - pip install awscli githubrelease + - export BUILD_VERSION=$(cat $CI_PROJECT_DIR/src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+') + - export BUILD_APK_FILENAME=browser-$BUILD_VERSION-release.apk + script: + - githubrelease release lbryio/lbry-android create $CI_COMMIT_TAG --publish bin/$BUILD_APK_FILENAME + - aws s3 cp bin/$BUILD_APK_FILENAME s3://build.lbry.io/android/latest.apk diff --git a/.gitsecret/keys/mapping.cfg b/.gitsecret/keys/mapping.cfg new file mode 100644 index 00000000..e69de29b diff --git a/.gitsecret/keys/pubring.kbx b/.gitsecret/keys/pubring.kbx new file mode 100644 index 00000000..b5b2e868 Binary files /dev/null and b/.gitsecret/keys/pubring.kbx differ diff --git a/.gitsecret/keys/pubring.kbx~ b/.gitsecret/keys/pubring.kbx~ new file mode 100644 index 00000000..64baf5a6 Binary files /dev/null and b/.gitsecret/keys/pubring.kbx~ differ diff --git a/.gitsecret/keys/trustdb.gpg b/.gitsecret/keys/trustdb.gpg new file mode 100644 index 00000000..507f7500 Binary files /dev/null and b/.gitsecret/keys/trustdb.gpg differ diff --git a/.gitsecret/paths/mapping.cfg b/.gitsecret/paths/mapping.cfg new file mode 100644 index 00000000..dba90436 --- /dev/null +++ b/.gitsecret/paths/mapping.cfg @@ -0,0 +1 @@ +lbry-android.keystore: diff --git a/lbry-android.keystore.secret b/lbry-android.keystore.secret new file mode 100644 index 00000000..3768f7c9 Binary files /dev/null and b/lbry-android.keystore.secret differ diff --git a/release.sh b/release.sh index 6e388494..506bf746 100755 --- a/release.sh +++ b/release.sh @@ -1,9 +1,9 @@ -#!/bin/sh +#!/bin/bash cd app react-native bundle --platform android --dev false --entry-file src/index.js --bundle-output ../src/main/assets/index.android.bundle --assets-dest ../src/main/res/ cd .. version=$(cat src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+') -buildozer android release +buildozer android release <<< y jarsigner -verbose -sigalg SHA1withRSA \ -digestalg SHA1 \ -keystore lbry-android.keystore \