aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/deploy.py8
-rw-r--r--scripts/deploy.sh16
2 files changed, 24 insertions, 0 deletions
diff --git a/scripts/deploy.py b/scripts/deploy.py
new file mode 100644
index 000000000..04f3e8229
--- /dev/null
+++ b/scripts/deploy.py
@@ -0,0 +1,8 @@
+import os
+
+import requests
+
+url = os.environ.get("AUTODEPLOY_WEBHOOK")
+token = os.environ.get("AUTODEPLOY_TOKEN")
+result = requests.get(url=url, headers={'token': token})
+print(result.text)
diff --git a/scripts/deploy.sh b/scripts/deploy.sh
new file mode 100644
index 000000000..98b9a9462
--- /dev/null
+++ b/scripts/deploy.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+# Build and deploy on master branch
+if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then
+ echo "Connecting to docker hub"
+ echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
+
+ echo "Building image"
+ docker build -t pythondiscord/bot:latest .
+
+ echo "Pushing image"
+ docker push pythondiscord/bot:latest
+
+ echo "Deploying container"
+ pipenv run python scripts/deploy.py
+fi