Skip to content

Commit

Permalink
add version check to CI deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
jvolkening committed Feb 10, 2024
1 parent f4b1dfd commit 822752e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ jobs:
submodules: recursive
- run: perl -V
- run: cpanm --notest --installdeps --verbose .
- run: cpanm MetaCPAN::Client
- run: perl Build.PL
- run: ./Build
- run: ./Build deploy
12 changes: 12 additions & 0 deletions Build.PL
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,21 @@ my $deployer = Module::Build->subclass(
sub ACTION_deploy {
require CPAN::Uploader;
require MetaCPAN::Client;
use version;
my $self = shift;
$self->depends_on("dist");
# check that this is a newer version
my $name = $self->dist_name;
my $mpan = MetaCPAN::Client->new();
my $existing = $mpan->release($name)->version;
if (version->parse($existing) >= version->parse($self->dist_version)) {
warn "This version is <= the version on CPAN, aborting nicely\n";
return 1;
}
my $tarball = $self->dist_dir() . '.tar.gz';
die "tarball not found"
if (! -e $tarball);
Expand Down

0 comments on commit 822752e

Please sign in to comment.