-
Notifications
You must be signed in to change notification settings - Fork 25
/
Envoy.blade.php
67 lines (55 loc) · 1.91 KB
/
Envoy.blade.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
@setup
// Deployment configuration ----------
$project = '%app.hostname%';
$user = '%deployment.user%';
$server = '%deployment.server%';
$directory = 'public_html/%app.hostname%/';
$slackWebhook = 'https://hooks.slack.com/services/your/slack/webhook/url';
// -----------------------------------
$author = isset($author) ? $author : "someone";
$branch = isset($branch) ? $branch : "unknown branch";
$commit = isset($commit) ? $commit : "no message";
@endsetup
@servers(['web' => $user . '@' . $server, 'localhost' => '127.0.0.1'])
@story('deploy')
update
@endstory
@task('update', ['on' => 'web'])
cd {{ $directory }}
git pull
[ ! -f composer.phar ] && (curl -sS https://getcomposer.org/installer | php -- --1)
php composer.phar install --no-interaction --no-dev --prefer-dist --ignore-platform-reqs
php ./vendor/bin/october install
php artisan -v october:up
## START UPDATE CHECK
LOCK_FILE=".last-update-check"
NOW=$(date +%s)
LAST_CHECK=$( [ -f $LOCK_FILE ] && cat $LOCK_FILE || echo 0 )
SECONDS_SINCE=$(expr $NOW - $LAST_CHECK)
if [ "$SECONDS_SINCE" -gt "86400" ]; then
HOSTNAME=$( hostname )
GIT=$( which git )
php composer.phar self-update
php ./vendor/bin/october update
if [[ -n $(git status -s) ]]; then
$GIT add --all .
$GIT commit -m "[ci skip] oc-bootstrapper updated October CMS ({{ $project }})"
$GIT push origin master
fi
echo $NOW > $LOCK_FILE
else
echo "Skipping update check (last check was $SECONDS_SINCE seconds ago)"
fi
## END UPDATE CHECK
git status -s
@endtask
@finished
$message = sprintf(
"`%s` deployed `%s` via `%s`:\n\n> %s",
ucfirst($author),
$project,
$branch,
$commit
);
@slack($slackWebhook, 'deployments', $message)
@endfinished