Search code examples
perlmodulereleasecpan

Is there an automatic way to build the "Changes" file from `git log` when publishing a perl module?


This is a perl-module specific question:

I already have my history and version tags in git so it would be nice to sync ./Changes with git log just before publishing the module update.

Specifically I am looking for something that generates the Changes file in the format that perl module Changes files are supposed to be in for a CPAN summary:

<version>   <date>
    Change 5
    Change 6
<version>   <date>
    Change 3
    Change 4
<version>   <date>
    Change 1
    Change 2

The way I write my commits, the git log --online entry is correctly formatted for a Changes file, no unnecessary noise. At least for the moment since I'm the only author this is a consistent policy.

How would you make git --online create a version file based on tags and iteratively get the --online entries for each tag?


Solution

  • I take a bit of a different approach an automatically ģenerate a Release file that is signed by my gpg key as part of the release on cpan.

    if you use Dist::Zilla as part of your release process it could be added into dist.ini. It is available at https://metacpan.org/pod/Dist::Zilla::Plugin::SignReleaseNotes

    I use it to publish a release note on github.com for my modules that has the checksum of the cpan release file and the git commits since the last release all in a signed message. See https://github.com/perl-net-saml2/perl-Net-SAML2/releases for an example.

    I still maintain a separate Changes file. If this helps great if not the code in there will show you how to get the online commits between the latest tag an the previous.