From 85afb2dc4159a3eaae5c21289efdd2eb97685fc3 Mon Sep 17 00:00:00 2001 From: Christopher Baklid Date: Wed, 7 Feb 2018 22:55:42 +0100 Subject: only deploy on master branch (#4) * adds python script to handle branch condition * satisfy snekchek * snekchekd to death --- deploy.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 deploy.py (limited to 'deploy.py') diff --git a/deploy.py b/deploy.py new file mode 100644 index 00000000..4e45b1f0 --- /dev/null +++ b/deploy.py @@ -0,0 +1,16 @@ +import os + +import requests + + +branch = os.environ.get("TRAVIS_BRANCH") +url = os.environ.get("AUTODEPLOY_WEBHOOK") +token = os.environ.get("AUTODEPLOY_TOKEN") + +if branch == 'master': + print("deploying..") + result = requests.post(url=url, headers={'token': token}) + print(result.text) + +else: + print("skipping deploy") -- cgit v1.2.3 From aaf007a9b07d81cd47dca157807c079ea4c561ea Mon Sep 17 00:00:00 2001 From: Christopher Baklid Date: Wed, 7 Feb 2018 23:07:59 +0100 Subject: Travis deploy on master (#5) * adds python script to handle branch condition --- deploy.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'deploy.py') diff --git a/deploy.py b/deploy.py index 4e45b1f0..189b5f0c 100644 --- a/deploy.py +++ b/deploy.py @@ -7,9 +7,14 @@ branch = os.environ.get("TRAVIS_BRANCH") url = os.environ.get("AUTODEPLOY_WEBHOOK") token = os.environ.get("AUTODEPLOY_TOKEN") -if branch == 'master': +PR = os.environ.get("TRAVIS_PULL_REQUEST") + +print('branch:', branch) +print('is_pr:', PR) + +if branch == 'master' and PR == 'false': print("deploying..") - result = requests.post(url=url, headers={'token': token}) + result = requests.get(url=url, headers={'token': token}) print(result.text) else: -- cgit v1.2.3