masterfermin02 / cloud-ways-deploy
用于 Cloudways 的 PHP 编写的部署工具。
v1.0.1
2021-03-14 03:31 UTC
Requires
- php: ^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.14
- phpunit/phpunit: ~9
- squizlabs/php_codesniffer: ~3.0
- vimeo/psalm: ^4.6
README
cloudways-deployment
用于将应用程序部署到 Cloudways 的 PHP 编写的部署工具。
安装和使用
此包需要 PHP 8 或更高版本。
- 通过 composer 安装
composer require masterfermin02/cloud-ways-deploy
使用
- 配置 git webhook 文档
- 部署示例脚本
<?php declare(strict_types=1); require __DIR__ . '/../vendor/autoload.php'; use Dotenv\Dotenv; $dotenv = Dotenv::createImmutable(__DIR__ . '/../'); $dotenv->load(); use App\Input; use CloudWays\Deploy\Client; use CloudWays\Requester; use CloudWays\Server; $apiKey = $_ENV['API_KEY']; // API key clouds ways key $API_URL = $_ENV['API_URL']; // your cloudways server api url $email = $_ENV['DEPLOYMENT_EMAIL']; // your email to receive notifiy on deploy finish $input = Input::create(array_merge($_GET, $_POST)); // git web hook example url http://yourserver/deployApplication.php?server_id=1234&app_id=1234&git_url=git_url&branch_name=master&deploy_path=path_to_your_app $gitPullResponse = Client::create($email, $apiKey, Requester::create($API_URL)) ->execute(Server::create( $input->get('server_id'), $input->get('git_url'), $input->get('branch_name'), $input->get('app_id') )); echo (json_encode($gitPullResponse));
测试
使用以下命令运行测试
composer test
贡献
有关详细信息,请参阅 CONTRIBUTING