From 870e4b1ae2fc85f4acd2b833dc8840074f3db5eb Mon Sep 17 00:00:00 2001 From: Jonathan Visser Date: Thu, 2 Jul 2026 15:45:44 +0200 Subject: [PATCH 1/3] Add tideways contrib task to push new releases --- contrib/tideways.php | 109 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 contrib/tideways.php diff --git a/contrib/tideways.php b/contrib/tideways.php new file mode 100644 index 000000000..332a49d7e --- /dev/null +++ b/contrib/tideways.php @@ -0,0 +1,109 @@ + 'Qm8JxL2...' +]); +``` + +### Suggested Usage + +Since you should only notify Tideways of a successful deployment, the deploy:tideways task should be executed right at the end. + +```php +// deploy.php + +after('deploy', 'deploy:tideways'); +``` + + */ + +namespace Deployer; + +use Deployer\Utility\Httpie; + +desc('Notifies Tideways of deployment'); +task( + 'deploy:tideways', + static function () { + $defaultConfig = [ + 'name' => get('release_name'), + 'type' => 'release', + 'description' => null, + 'environment' => null, + 'service' => null, + 'compareAfterMinutes' => 90 + ]; + + $config = array_merge($defaultConfig, (array) get('tideways')); + array_walk( + $config, + static function (&$value) use ($config) { + if (is_callable($value)) { + $value = $value($config); + } + }, + ); + + if ( + !isset($config['api_key']) + || empty($config['api_key']) + ) { + throw new \RuntimeException( + << 'Qm8JxL2...', + ] + );" + EXAMPLE, + ); + } + + $releaseData = array_filter( + [ + 'apiKey' => $config['api_key'], + 'name' => ($config['name_prefix'] ?? '') . $config['name'], + 'description' => $config['description'], + 'type' => $config['type'], + 'environment' => $config['environment'], + 'service' => $config['service'], + 'compareAfterMinutes' => $config['compareAfterMinutes'] + ], + ); + + $response = Httpie::post('https://app.tideways.io/api/events') + ->setopt(CURLOPT_TIMEOUT, 10) + ->jsonBody($releaseData) + ->getJson(); + + if (!isset($response['ok'], $response['id']) || $response['ok'] !== true) { + throw new \RuntimeException(sprintf('Unable to create a release: %s', print_r($response, true))); + } + + writeln( + sprintf( + 'Tideways: Release of version %s ' + . 'for project: %s created successfully.', + $releaseData['name'], + $response['name'], + ), + ); + }, +); From ff469194ced8f5ff272e5a92d66e2dd73bb5ed8d Mon Sep 17 00:00:00 2001 From: Jonathan Visser Date: Thu, 2 Jul 2026 15:47:02 +0200 Subject: [PATCH 2/3] Add documentation for Tideways recipe --- docs/contrib/README.md | 1 + docs/contrib/tideways.md | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 docs/contrib/tideways.md diff --git a/docs/contrib/README.md b/docs/contrib/README.md index 44faf7be9..c95c16872 100644 --- a/docs/contrib/README.md +++ b/docs/contrib/README.md @@ -30,6 +30,7 @@ * [Slack Recipe](/docs/contrib/slack.md) * [Supervisord-monitor Recipe](/docs/contrib/supervisord-monitor.md) * [Telegram Recipe](/docs/contrib/telegram.md) +* [Tideways Recipe](/docs/contrib/tideways.md) * [Webpack_encore Recipe](/docs/contrib/webpack_encore.md) * [Workplace Recipe](/docs/contrib/workplace.md) * [Yammer Recipe](/docs/contrib/yammer.md) diff --git a/docs/contrib/tideways.md b/docs/contrib/tideways.md new file mode 100644 index 000000000..95f7e0791 --- /dev/null +++ b/docs/contrib/tideways.md @@ -0,0 +1,38 @@ + + + + +# Tideways Recipe + +```php +require 'contrib/tideways.php'; +``` + +[Source](/contrib/tideways.php) + + + +### Configuration options +- **api_key** *(required)*: Check to "Project Settings" to find the API key necessary to authenticate the Create Event request. +- **name** *(optional)*: Name of the release, defaults to Deployer release name +- **name_prefix** *(optional)*: a string prefixed to version. +- **type** *(optional)*: Type of the event. Currently supports `release` and `marker`, defaults to `release`. +- **description** *(optional)*: More details about the release. +- **environment** *(optional)*: The environment this release is performed on, otherwise the default environment is used. +- **service** *(optional)*: The service this release is performed on, otherwise the default service of the project is used. +- **compareAfterMinutes** *(optional)*: Defaults to 90 minutes. Specifies the timeframes around the event for which the performance will be compared. Supported values are between 5 minutes and 1440 minutes (one day). +```php +deploy.php +set('tideways', [ + 'api_key' => 'Qm8JxL2...' +]); +``` +### Suggested Usage +Since you should only notify Tideways of a successful deployment, the deploy:tideways task should be executed right at the end. +```php +deploy.php +after('deploy', 'deploy:tideways'); +``` + + + From 2cf2965a40a2f6d729f8c6586bd901561d42e79e Mon Sep 17 00:00:00 2001 From: Jonathan Visser Date: Thu, 2 Jul 2026 15:55:37 +0200 Subject: [PATCH 3/3] Fix PHP CS error for missing commas --- contrib/tideways.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/tideways.php b/contrib/tideways.php index 332a49d7e..306f10fdb 100644 --- a/contrib/tideways.php +++ b/contrib/tideways.php @@ -46,7 +46,7 @@ static function () { 'description' => null, 'environment' => null, 'service' => null, - 'compareAfterMinutes' => 90 + 'compareAfterMinutes' => 90, ]; $config = array_merge($defaultConfig, (array) get('tideways')); @@ -84,7 +84,7 @@ static function (&$value) use ($config) { 'type' => $config['type'], 'environment' => $config['environment'], 'service' => $config['service'], - 'compareAfterMinutes' => $config['compareAfterMinutes'] + 'compareAfterMinutes' => $config['compareAfterMinutes'], ], ); @@ -96,7 +96,7 @@ static function (&$value) use ($config) { if (!isset($response['ok'], $response['id']) || $response['ok'] !== true) { throw new \RuntimeException(sprintf('Unable to create a release: %s', print_r($response, true))); } - + writeln( sprintf( 'Tideways: Release of version %s '