allerta-vvf/deployment.php

79 lines
1.6 KiB
PHP
Raw Normal View History

2020-12-29 23:55:28 +01:00
<?php
$baseConfig = [
2021-12-24 18:23:06 +01:00
'local' => 'backend',
2020-12-29 23:55:28 +01:00
'ignore' => '
.git*
.github
.vscode
*.json
config.old.php
config.php
2022-01-04 00:28:57 +01:00
keys
2020-12-29 23:55:28 +01:00
*tests*
*tests
*examples*
*examples
*Makefile*
2021-03-09 10:12:17 +01:00
*LICENSE*
*CREDITS*
*VERSION*
*CHANGELOG*
2020-12-29 23:55:28 +01:00
*.md
*.rst
*.txt
2021-03-09 10:12:17 +01:00
!robots.txt
2020-12-29 23:55:28 +01:00
*.sh
*editorconfig
*doc*
*.yml
*.travis*
*.eslintrc*
*.phpstorm*
*.php_cs*
*.xml
*phpcs*
*phpstan*
*phpunit*
vendor/nikic/fast-route/test
*.lock
2021-03-01 22:39:49 +01:00
*.zip
2020-12-29 23:55:28 +01:00
',
2021-05-01 00:28:14 +02:00
'allowDelete' => false,
2020-12-29 23:55:28 +01:00
'before' => [
2021-12-24 18:23:06 +01:00
'local: cd backend && composer update --no-dev -o'
2020-12-29 23:55:28 +01:00
],
'after' => [
2021-12-24 18:23:06 +01:00
'local: cd backend && composer install'
2020-12-29 23:55:28 +01:00
],
'filePermissions' => "0644",
'dirPermissions' => "0755"
];
try {
require("deployment_remotes.php");
} catch (\Throwable $th) {
print("ERROR: no 'deployment_remotes.php' file.".PHP_EOL);
print("Rename 'deployment_remotes.sample.php' in 'deployment_remotes.php' and edit remotes config.".PHP_EOL);
exit();
}
$config = [];
foreach ($remotes as $key => $value) {
2021-02-20 21:05:03 +01:00
$config[$key] = array_merge($value, $baseConfig);
if(isset($value["before"]) && $value["before"] === false){
$config[$key]["before"] = [];
} else {
$env = isset($config[$key]["sentry_env"]) ? $config[$key]["sentry_env"] : "prod";
2021-12-24 18:23:06 +01:00
$config[$key]["before"][] = "local: cd frontend && npm ci && npm run build";
2021-02-20 21:05:03 +01:00
}
if(isset($value["after"]) && $value["after"] === false){
$config[$key]["after"] = [];
}
2021-04-29 18:30:53 +02:00
if(isset($config[$key]["skip_composer_upload"]) && $config[$key]["skip_composer_upload"]){
$config[$key]["ignore"] .= "
vendor";
}
2020-12-29 23:55:28 +01:00
}
return $config;