aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xfiles/clever-deploy.sh15
-rw-r--r--tasks/deploy.yml2
-rw-r--r--tasks/setup.yml1
3 files changed, 17 insertions, 1 deletions
diff --git a/files/clever-deploy.sh b/files/clever-deploy.sh
new file mode 100755
index 0000000..c301a89
--- /dev/null
+++ b/files/clever-deploy.sh
@@ -0,0 +1,15 @@
1#!/usr/bin/env bash
2
3function getHeadRev {
4 git rev-parse HEAD
5}
6
7target_commit="$(getHeadRev)"
8running_commit=$(clever status | grep running | sed 's/^.*Commit: //' | sed 's/)$//')
9
10if [ "${running_commit}" != "${target_commit}" ]; then
11 echo "Deploying commit ${target_commit}"
12 clever deploy --force
13else
14 echo "${target_commit} is already deployed, nothing to do"
15fi
diff --git a/tasks/deploy.yml b/tasks/deploy.yml
index f9d8408..ae11921 100644
--- a/tasks/deploy.yml
+++ b/tasks/deploy.yml
@@ -47,7 +47,7 @@
47 changed_when: false 47 changed_when: false
48 48
49- name: Deploy to Clever-Cloud 49- name: Deploy to Clever-Cloud
50 shell: "clever deploy --force" 50 command: "{{ ansible_env.HOME }}/{{ clever_user_path }}/clever-deploy.sh"
51 args: 51 args:
52 chdir: "{{ clever_app_root }}" 52 chdir: "{{ clever_app_root }}"
53 environment: 53 environment:
diff --git a/tasks/setup.yml b/tasks/setup.yml
index 8a11772..89bc518 100644
--- a/tasks/setup.yml
+++ b/tasks/setup.yml
@@ -27,6 +27,7 @@
27 dest: "{{ ansible_env.HOME }}/{{ clever_user_path }}/{{ item }}" 27 dest: "{{ ansible_env.HOME }}/{{ clever_user_path }}/{{ item }}"
28 mode: 0755 28 mode: 0755
29 with_items: 29 with_items:
30 - clever-deploy.sh
30 - clever-set-domain.sh 31 - clever-set-domain.sh
31 - clever-set-drain.sh 32 - clever-set-drain.sh
32 - clever-set-scalability.sh 33 - clever-set-scalability.sh