From 4e22a33dc4ac27a8536541e8a8cce7f15681a452 Mon Sep 17 00:00:00 2001 From: Nicolai Bjerre Pedersen Date: Thu, 8 Mar 2018 19:50:57 +0100 Subject: [PATCH] Updated build script to only push if the commit is tagged. Otherwise it should just test the build. --- .travis.yml | 2 +- build.sh | 31 +++++++++++++++++++++++++++++++ distribute.sh | 13 ------------- 3 files changed, 32 insertions(+), 14 deletions(-) create mode 100755 build.sh delete mode 100755 distribute.sh diff --git a/.travis.yml b/.travis.yml index b867663..80bbbba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ sudo: required services: - docker script: -- "$TRAVIS_BUILD_DIR/distribute.sh" +- "$TRAVIS_BUILD_DIR/build.sh" env: global: secure: I1qaPNCHzZ0rntK1/aMMSCI50zhIdHO+V2UPwimUHmlQ8YdW1dUnuictFFoGEbp2S7owub9U4cwm5LHp8VjtrnDxoDEBuzb50RMTQ8vNWE4SAILawe9TWKfHQKqgCgONQsv9O4Bh8moqwDD+PrqnoGvqEsRjiS6Icx8jk1zCvy7WDzpgnZIHIzytAudRTNwVb/nIJWGMfG29ekxqLgX1YXQ6XsZfQm+JSt8a8dGLdYoYQZRbrriznanYkeMrBanwkKQgbmA1MirIwfcprvnXad1aX8l6/uKomvehc1PbUH6DXUqq8lzuu42gF+J9W3aL4YtbWYtzOItq2Hi0nnj26EvUyn1yIGzfCXv4j3eNA6cqplPKePZ9dYREx0bEiQP412T6w1WviRrhB4THSeCmn6HCkb/k2quTX4vLT1lQWOv4CRe0Qp5kHExbe2kGREJONiUsXU/6zKtT4S+iF9g5EalCaG8beFIwYllkbcSIsle/mfjHKTvwwQ8vI0cnRb7aKLI1pLgb6fQVIRN5ia+fwOvd/S/phy30wAzqtAjuxehbJ8dmnaS0Q21CRUmMAsRJ09x4KUTRMg0hBVib7JJ6jPQIvGgyILe4aJtBFZ5upxwPtk3eEc29RV/FbgJzPa7419boPflIpPY20a+VkfUpSjD4UcS/Xvd+6bjOecT9Fh4= diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..5a9d80d --- /dev/null +++ b/build.sh @@ -0,0 +1,31 @@ +set -ev +docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD" + +if [ -z ${TRAVIS_TAG} ]; then + echo "Untagged build found. Building to test." + docker run -it --rm --privileged --name "${ADDON_NAME}" \ + -v ~/.docker:/root/.docker \ + -v "$(pwd)":/docker \ + hassioaddons/build-env:latest \ + --target "${ADDON_NAME}" \ + --git \ + --all \ + --from "homeassistant/{arch}-base" \ + --author "Nicolai Bjerre Pedersen " \ + --doc-url "${GITHUB_URL}" \ + --image "fixated/${ADDON_NAME}-{arch}" +else + echo "New git tagged build found. Building to distribute." + docker run -it --rm --privileged --name "${ADDON_NAME}" \ + -v ~/.docker:/root/.docker \ + -v "$(pwd)":/docker \ + hassioaddons/build-env:latest \ + --target "${ADDON_NAME}" \ + --git \ + --all \ + --push \ + --from "homeassistant/{arch}-base" \ + --author "Nicolai Bjerre Pedersen " \ + --doc-url "${GITHUB_URL}" \ + --image "fixated/${ADDON_NAME}-{arch}" +fi diff --git a/distribute.sh b/distribute.sh deleted file mode 100755 index c6eb8d6..0000000 --- a/distribute.sh +++ /dev/null @@ -1,13 +0,0 @@ -set -ev -docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD" -docker run -it --rm --privileged --name "${ADDON_NAME}" \ - -v ~/.docker:/root/.docker \ - -v "$(pwd)":/docker \ - hassioaddons/build-env:latest \ - --target "${ADDON_NAME}" \ - --git \ - --all \ - --push \ - --from "homeassistant/{arch}-base" \ - --author "Nicolai Bjerre Pedersen " \ - --doc-url "${GITHUB_URL}"