Created
February 12, 2018 02:24
-
-
Save chriskacerguis/2d4e1c77c5696287bfdf98d206d2958e to your computer and use it in GitHub Desktop.
Auto-deploy script for new Home Assistant config when passes in Travis CU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ ! -f /tmp/last_build.txt ]; then | |
touch /tmp/last_build.txt | |
fi | |
current_build=`curl -H "Travis-API-Version: 3" -s https://api.travis-ci.org/repo/14706137/branch/master | jq .last_build.number` | |
current_build="${current_build%\"}" | |
current_build="${current_build#\"}" | |
current_status=`curl -H "Travis-API-Version: 3" -s https://api.travis-ci.org/repo/14706137/branch/master | jq .last_build.state` | |
current_status="${current_status%\"}" | |
current_status="${current_status#\"}" | |
last_build=`cat /tmp/last_build.txt` | |
if [[ "$current_status" == "passed" && "$current_build" != "$last_build" ]] ; then | |
cd /data/home-assistant ; git pull | |
rancher restart --env 1a5 automation/home-assistant | |
echo $current_build > /tmp/last_build.txt | |
fi; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment