Added Circle CI automatic builds

Now when adding a new tag, Circle CI automagically build a release signed apk and add it to assets.

Signed-off-by: Óscar García Amor <ogarcia@connectical.com>
This commit is contained in:
Óscar García Amor 2018-01-25 18:46:23 +01:00
parent 769b298415
commit 23d4715ff1
2 changed files with 56 additions and 0 deletions

View File

@ -58,6 +58,48 @@ jobs:
command: | command: |
. ~/venv/bin/activate . ~/venv/bin/activate
tx push -st tx push -st
generate_signed_apk:
docker:
- image: circleci/android:api-27-alpha
working_directory: ~/ultrasonic
envoronment:
JVM_OPTS: -Xmx3200m
steps:
- checkout
- restore_cache:
key: gradle-cache-{{ checksum "dependencies.gradle" }}
- run:
name: decrypt ultrasonic-keystore
command: openssl aes-256-cbc -K ${ULTRASONIC_KEYSTORE_KEY} -iv ${ULTRASONIC_KEYSTORE_IV} -in ultrasonic-keystore.enc -out ultrasonic-keystore -d
- run:
name: build release apk
command: ./gradlew build assembleRelease
- run:
name: sign release apk
command: |
mkdir -p /tmp/ultrasonic-release
cd ultrasonic/build/outputs/apk/release/
for apk in *.apk; do
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ~/ultrasonic/ultrasonic-keystore -storepass ${ULTRASONIC_KEYSTORE_STOREPASS} -keypass ${ULTRASONIC_KEYSTORE_KEYPASS} ${apk} ultrasonic
jarsigner -verify ${apk}
${ANDROID_HOME}/build-tools/27.0.0/zipalign -v 4 ${apk} /tmp/ultrasonic-release/${apk/-release/}
done
- persist_to_workspace:
root: /tmp/ultrasonic-release
paths:
- ultrasonic-*.apk
publish_signed_apk:
docker:
- image: circleci/golang
steps:
- attach_workspace:
at: /tmp/ultrasonic-release
- run:
name: install ghr
command: go get -v github.com/tcnksm/ghr
- run:
name: publish release on tag
command: ghr -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} ${CIRCLE_TAG} /tmp/ultrasonic-release
workflows: workflows:
version: 2 version: 2
build_and_push_translations: build_and_push_translations:
@ -71,4 +113,18 @@ workflows:
only: only:
- develop - develop
- master - master
- generate_signed_apk:
filters:
tags:
only: /^[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
- publish_signed_apk:
requires:
- generate_signed_apk
filters:
tags:
only: /^[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/

BIN
ultrasonic-keystore.enc Normal file

Binary file not shown.