-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.php
63 lines (46 loc) · 1.58 KB
/
deploy.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
<?php
declare(strict_types=1);
namespace Deployer;
require 'contrib/php-fpm.php';
require 'contrib/telegram.php';
require 'recipe/laravel.php';
// Config
set('application', 'Laravel-Lang: Webhooks');
set('repository', '[email protected]:Laravel-Lang/webhooks-service.git');
set('php_fpm_version', '8.3');
set('telegram_token', $_SERVER['TELEGRAM_DRAGON_BOT_TOKEN']);
set('telegram_chat_id', $_SERVER['TELEGRAM_DRAGON_BOT_CHAT_ID']);
$title = '*{{application}}*' . PHP_EOL . PHP_EOL;
set('telegram_text', $title . 'Deploying `{{branch}}` to *{{target}}*');
set('telegram_success_text', $title . 'Deployed some fresh code to *{{target}}*');
set('telegram_failure_text', $title . 'Something went wrong during deployment to *{{target}}*');
// Hosts
host('production')
->setHostname($_SERVER['DEPLOY_IP'])
->setRemoteUser('forge')
->setDeployPath('~/domains/' . $_SERVER['DEPLOY_HOST']);
// Tasks
task('deploy', [
'deploy:prepare',
'deploy:vendors',
'artisan:optimize:clear',
'artisan:optimize',
'artisan:migrate',
'artisan:operations:before',
'deploy:publish',
'php-fpm:reload',
'artisan:queue:restart',
'artisan:operations',
]);
task('artisan:operations', function () {
cd('{{release_path}}');
run('{{bin/php}} artisan operations');
});
task('artisan:operations:before', function () {
cd('{{release_path}}');
run('{{bin/php}} artisan operations --before');
});
before('deploy', 'telegram:notify');
after('deploy:success', 'telegram:notify:success');
after('deploy:failed', 'deploy:unlock');
after('deploy:failed', 'telegram:notify:failure');