App-GitHooks-Plugin-NotifyReleasesToSlack

 view release on metacpan or  search on metacpan

lib/App/GitHooks/Plugin/NotifyReleasesToSlack.pm  view on Meta::CPAN

package App::GitHooks::Plugin::NotifyReleasesToSlack;

use strict;
use warnings;

use feature 'state';

use base 'App::GitHooks::Plugin';

# External dependencies.
use CPAN::Changes;
use Data::Dumper;
use JSON qw();
use LWP::UserAgent;
use Log::Any qw($log);
use Try::Tiny;

# Internal dependencies.
use App::GitHooks::Constants qw( :PLUGIN_RETURN_CODES );

# Uncomment to see debug information.
#use Log::Any::Adapter ('Stderr');


=head1 NAME

App::GitHooks::Plugin::NotifyReleasesToSlack - Notify Slack channels of new releases pushed from a repository.


=head1 DESCRIPTION

If you maintain a changelog file, and tag your release commits, you can use
this plugin to send the release notes to Slack channels.

Here is a practical scenario:

=over 4

=item 1.

Install C<App::GitHooks::Plugin::NotifyReleasesToSlack>.

=item 2.

Set up an incoming webhook in Slack. This should give you a URL to post
messages to, with a format similar to
C<https://hooks.slack.com/services/.../.../...>.

=item 3.

Configure the plugin in your C<.githooksrc> file:

	[NotifyReleasesToSlack]
	slack_post_url = ...
	slack_channels = #releases, #test
	changelog_path = Changes

=item 4.

Add release notes in your changelog file:

	v1.0.0  2015-04-12
	        - Added first feature.
	        - Added second feature.

=item 5.

Commit your release notes:

	git commit Changelog -m 'Release version 1.0.0.'

=item 6.

Tag your release:

	git tag v1.0.0



( run in 1.741 second using v1.01-cache-2.11-cpan-39bf76dae61 )