Release script for image with real device support
This commit is contained in:
parent
2bc30edf4c
commit
488e53149c
12
.travis.yml
12
.travis.yml
|
@ -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
48
release_real.sh
Normal 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
|
13
travis.sh
13
travis.sh
|
@ -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
|
||||||
echo "Log in to docker hub"
|
if [ ! -z "$ANDROID_VERSION" ]; then
|
||||||
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
|
echo "Log in to docker hub"
|
||||||
echo "[Version: $ANDROID_VERSION] RUN UNIT TEST, BUILD DOCKER IMAGES AND PUSH THOSE TO DOCKER HUB"
|
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
|
||||||
bash release.sh all $ANDROID_VERSION all $TRAVIS_TAG
|
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
|
||||||
|
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
|
||||||
|
|
Loading…
Reference in a new issue