Release script for image with real device support

This commit is contained in:
Andrejs Cunskis 2017-07-07 23:46:04 +03:00
parent 2bc30edf4c
commit 488e53149c
3 changed files with 63 additions and 10 deletions

View file

@ -11,12 +11,12 @@ services:
install: "pip install -r requirements.txt" install: "pip install -r requirements.txt"
env: env:
matrix:
- ANDROID_VERSION=5.0.1 - ANDROID_VERSION=5.0.1
- ANDROID_VERSION=5.1.1 - ANDROID_VERSION=5.1.1
- ANDROID_VERSION=6.0 - ANDROID_VERSION=6.0
- ANDROID_VERSION=7.0 - ANDROID_VERSION=7.0
- ANDROID_VERSION=7.1.1 - ANDROID_VERSION=7.1.1
- REAL_DEVICE=True
script: bash travis.sh script: bash travis.sh

48
release_real.sh Normal file
View file

@ -0,0 +1,48 @@
#!/bin/bash
if [ -z "$1" ]; then
read -p "Task (build|push|all) : " TASK
else
TASK=$1
fi
if [ -z "$2" ]; then
read -p "Release version: " RELEASE
else
RELEASE=$2
fi
IMAGE="butomo1989/docker-android"
FILE_NAME=docker/Real_device
image_version="$IMAGE-real-device:$RELEASE"
image_latest="$IMAGE-real-device:latest"
function build() {
echo "[BUILD] Image name: $image_version and $image_latest"
echo "[BUILD] Dockerfile: $FILE_NAME"
docker build -t $image_version -f $FILE_NAME .
docker tag $image_version $image_latest
}
function push() {
echo "[PUSH] Image name: $image_version and $image_latest"
docker push $image_version
docker push $image_latest
}
case $TASK in
build)
build
;;
push)
push
;;
all)
build
push
;;
*)
echo "Invalid environment! Valid options: test, build, push, all"
;;
esac

View file

@ -5,10 +5,15 @@ if [ -z "$TRAVIS_TAG" ]; then
echo "UNIT TEST ONLY" echo "UNIT TEST ONLY"
bash release.sh test all all 0.1 bash release.sh test all all 0.1
else else
if [ ! -z "$ANDROID_VERSION" ]; then
echo "Log in to docker hub" echo "Log in to docker hub"
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
echo "[Version: $ANDROID_VERSION] RUN UNIT TEST, BUILD DOCKER IMAGES AND PUSH THOSE TO DOCKER HUB" echo "[Version: $ANDROID_VERSION] RUN UNIT TEST, BUILD DOCKER IMAGES AND PUSH THOSE TO DOCKER HUB"
bash release.sh all $ANDROID_VERSION all $TRAVIS_TAG bash release.sh all $ANDROID_VERSION all $TRAVIS_TAG
elif [ ! -z "$REAL_DEVICE" ]; then
echo "[SUPPORT FOR REAL DEVICE: BUILD DOCKER IMAGES AND PUSH THOSE TO DOCKER HUB ]"
bash release_real.sh all $TRAVIS_TAG
fi
echo "Log out of docker hub" echo "Log out of docker hub"
docker logout docker logout
fi fi