-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.php
59 lines (41 loc) · 1.53 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
<?php
// @formatter:off
declare(strict_types=1);
namespace Deployer;
require 'contrib/php-fpm.php';
require 'contrib/telegram.php';
require 'recipe/laravel.php';
// Config
set('application', 'The Dragon Code: Webhooks Template');
set('repository', '[email protected]:TheDragonCode/telegram-webhooks-template.git');
set('php_fpm_version', '8.1');
set('telegram_token', $_SERVER['TELEGRAM_BOT_TOKEN'] ?? '');
set('telegram_chat_id', $_SERVER['TELEGRAM_LOGS_CHAT_ID'] ?? '');
set('telegram_text', 'Deploying `{{branch}}` to *{{target}}*' . PHP_EOL . PHP_EOL . '*Application*: {{application}}');
set('telegram_success_text', 'Deployed some fresh code to *{{target}}*' . PHP_EOL . PHP_EOL . '*Application*: {{application}}');
set('telegram_failure_text', 'Something went wrong during deployment to *{{target}}*' . PHP_EOL . PHP_EOL . '*Application*: {{application}}');
// Hosts
host('production')
->setHostname('37.143.9.153')
->setRemoteUser('forge')
->setDeployPath('~/domains/telegram-webhooks-template');
// Tasks
task('deploy', [
'deploy:prepare',
'deploy:vendors',
'artisan:optimize:clear',
'artisan:optimize',
'artisan:event:cache',
'artisan:migrate',
'deploy:publish',
'php-fpm:reload',
'artisan:actions',
]);
task('artisan:actions', function () {
cd('{{release_path}}');
run('{{bin/php}} artisan actions');
});
before('deploy', 'telegram:notify');
after('deploy:success', 'telegram:notify:success');
after('deploy:failed', 'deploy:unlock');
after('deploy:failed', 'telegram:notify:failure');