-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.php
54 lines (43 loc) · 1.57 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
<?php
namespace Deployer;
require 'recipe/laravel.php';
require 'contrib/discord.php';
function configure(): void
{
set('repository', 'https://github.com/projectcitybuild/web.git');
add('shared_files', []);
add('shared_dirs', []);
add('writable_dirs', []);
host(getenv('DEPLOY_HOST'))
->set('remote_user', getenv('DEPLOY_USER'))
->set('deploy_path', getenv('DEPLOY_PATH'))
->set('branch', getenv('DEPLOY_BRANCH'))
->set('discord_channel', getenv('DEPLOY_DISCORD_CHANNEL_ID'))
->set('discord_token', getenv('DEPLOY_DISCORD_CHANNEL_TOKEN'));
after('deploy:failed', 'deploy:unlock');
}
function setupDiscordTasks(): void
{
before('deploy', 'discord:notify');
after('deploy:success', 'discord:notify:success');
after('deploy:failed', 'discord:notify:failure');
}
function setupFrontendTasks(): void
{
// The Laravel recipe doesn't build any frontend assets, so we need
// to run our frontend tasks after dependencies are installed
after('deploy:vendors', 'deploy:frontend');
// NVM doesn't play well with deployer
// https://github.com/deployphp/deployer/issues/2535
//
// Every command related tp npm must call `use_nvm` so that it's
// sourced in the run command's shell
set('use_nvm', 'source $HOME/.nvm/nvm.sh');
task('deploy:frontend', function () {
run('{{use_nvm}} && cd {{release_path}} && npm ci');
run('{{use_nvm}} && cd {{release_path}} && npm run build');
})->desc('Build frontend assets');
}
configure();
setupDiscordTasks();
setupFrontendTasks();