-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.php
65 lines (48 loc) · 1.67 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
64
65
<?php
/**
* This file is part of the "Volunteers CRM" project.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Andrey Helldar <[email protected]>
* @copyright 2022 Andrey Helldar
* @license MIT
*
* @see https://github.com/volunteers-crm
*/
declare(strict_types=1);
namespace Deployer;
require 'contrib/npm.php';
require 'contrib/telegram.php';
require 'recipe/laravel.php';
// Config
set('application', 'Volunteers CRM');
set('repository', '[email protected]:volunteers-crm/web.git');
// Notification
set('telegram_token', getenv('TELEGRAM_DEPLOY_TOKEN'));
set('telegram_chat_id', getenv('TELEGRAM_DEPLOY_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(getenv('DEPLOY_IP'))
->setRemoteUser('forge')
->setDeployPath('~/domains/' . getenv('DEPLOY_HOSTNAME'));
// Tasks
task('deploy', [
'deploy:prepare',
'npm:install',
'npm:run:prod',
'deploy:publish',
]);
task('npm:run:prod', function () {
cd('{{release_path}}');
//run('npm run build');
run('npx vite build');
});
before('deploy', 'telegram:notify');
after('deploy:success', 'telegram:notify:success');
after('deploy:failed', 'deploy:unlock');
after('deploy:failed', 'telegram:notify:failure');