diff --git a/README.md b/README.md new file mode 100644 index 0000000..bc57d6c --- /dev/null +++ b/README.md @@ -0,0 +1,117 @@ +# Release check-list for Deployer + +A simple recipe for [Deployer](https://github.com/deployphp/deployer) to manage a release check-list using Gitlab issues. + +The idea is the handle a list of mandatory (and non-blocking) tasks for a release. +This is made possible using a Gitlab issue (with its tasks system), with specific title and label (customisable). + +## Installation + +```bash +composer require novaway/deployer-release-check-list +``` + +## Configuration + +```php +// deploy.php +getOption('tag')`. +```php +set('rcl_release_version', get('my_release_version')); +``` + +### Examples + +In case of an uncompleted mandatory task: +![Uncompleted task](docs/mandatory_task.png "Mandatory task") + +Reminder for `post-release` tasks: +![Post-release task](docs/reminder.png "Reminder") + +### Bonus + +Get a slack notification for uncompleted post-release tasks (considering you already configured the slack recipe): +```php +// deploy.php +use Deployer\Task\Context; +use Deployer\Utility\Httpie; + +task('rcl:post-release-slack-reminder', function() { + if (!get('slack_webhook', false)) { + return; + } + + $pendingPostReleaseTasks = get('rcl_pending_post_release_tasks', []); + if (count($pendingPostReleaseTasks) === 0) { + return; + } + + $text = implode(PHP_EOL, array_map(function($item) { + return '- '.$item[1]; + }, $pendingPostReleaseTasks)); + + $host = Context::get()->getHost()->getHostname(); + + $attachment = [ + 'title' => sprintf('[%s][%s] Pending post-release tasks:', $host, get('release_version')), + 'text' => $text, + 'color' => get('slack_color'), + 'mrkdwn_in' => ['text'], + ]; + + Httpie::post(get('slack_webhook'))->body(['attachments' => [$attachment]])->send(); +}); + +after('success', 'rcl:post-release-slack-reminder'); +``` \ No newline at end of file diff --git a/docs/gitlab_issue.png b/docs/gitlab_issue.png new file mode 100644 index 0000000..7adf26c Binary files /dev/null and b/docs/gitlab_issue.png differ diff --git a/docs/mandatory_task.png b/docs/mandatory_task.png new file mode 100644 index 0000000..a48320c Binary files /dev/null and b/docs/mandatory_task.png differ diff --git a/docs/reminder.png b/docs/reminder.png new file mode 100644 index 0000000..a6b6091 Binary files /dev/null and b/docs/reminder.png differ