Gitlab CI (#498)

This commit is contained in:
Akinwale Ariwodola 2019-03-26 15:08:50 +01:00 committed by GitHub
parent d8b0e89c6c
commit f30f1f47d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 62 additions and 2 deletions

2
.gitignore vendored
View file

@ -9,3 +9,5 @@ src/main/assets/index.android.bundle.meta
*.log
.vagrant
lbry-android.keystore
.gitsecret/keys/random_seed

57
.gitlab-ci.yml Normal file
View file

@ -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

View file

BIN
.gitsecret/keys/pubring.kbx Normal file

Binary file not shown.

Binary file not shown.

BIN
.gitsecret/keys/trustdb.gpg Normal file

Binary file not shown.

View file

@ -0,0 +1 @@
lbry-android.keystore:

Binary file not shown.

View file

@ -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 \