-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.php
executable file
·61 lines (47 loc) · 2.29 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
<?php
namespace Deployer;
require 'recipe/wordpress.php';
// Project repository
$repo = null;
if($origin = exec("git config --get remote.origin.url")){
$repo = trim(parse_url($origin, PHP_URL_PATH), '/');
$repo = str_replace("git@github.com:", "", $repo);
$repo = substr($repo, 0, strpos($repo, ".git"));
}
set('repository_name', $repo);
set('repository', 'git@github.com:{{repository_name}}.git');
set('theme', "adeliom");
set('shared_dirs', ['web/app/uploads', 'web/app/sessions']);
set('writable_dirs', ['web/app/uploads', 'web/app/sessions']);
set('writable_mode', "chmod");
set('writable_recursive', true);
// Hosts
import('.inventory.yaml');
// Tasks
task('dotenv:set-env', static function (): void {
if(test("[ -f {{release_path}}/.env.local ]")){
run('rm {{release_or_current_path}}/.env.local');
}
run('touch {{release_or_current_path}}/.env.local');
run('echo "APP_ENV={{app_env}}" >> {{release_or_current_path}}/.env.local');
run(sprintf('cd {{release_or_current_path}} && {{bin/composer}} config http-basic.gf-composer-proxy.arnaud-ritti.workers.dev licensekey %s', base64_decode('MDYxNjhkYzA2YzQ1NWRjYWVkNmU0NzM2Y2EzNTBkMjg=')));
run(sprintf('cd {{release_or_current_path}} && {{bin/composer}} config http-basic.connect.advancedcustomfields.com %s https://universalautomation.adev3.ovh/', base64_decode('YjNKa1pYSmZhV1E5TkRBMk9UWjhkSGx3WlQxa1pYWmxiRzl3WlhKOFpHRjBaVDB5TURFMExUQTVMVEkySURFek9qVXpPakkx')));
});
task('npm:build', static function (): void {
if(commandExist('npm')){
run('cd {{release_or_current_path}}/web/app/themes/{{theme}} && npm install && npm run build:production');
}else{
runLocally('cd web/app/themes/{{theme}} && npm install && npm run build:production');
upload('web/app/themes/{{theme}}/build/', '{{release_or_current_path}}/web/app/themes/{{theme}}/build/');
}
});
task('upload:medias', static function (): void {
upload('web/app/uploads/', '{{release_or_current_path}}/web/app/uploads/');
});
task('download:medias', static function (): void {
download('{{release_or_current_path}}/web/app/uploads/', 'web/app/uploads/');
});
after('deploy:update_code', 'deploy:vendors');
before('deploy:vendors', 'dotenv:set-env');
before('deploy:symlink', 'npm:build');
after('deploy:failed', 'deploy:unlock');