Skip to content

Commit

Permalink
Add workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
theory committed Feb 6, 2024
1 parent 7431229 commit 3a4e831
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 3 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: CI
on:
push:
branches: ['*']
jobs:
build:
strategy:
matrix:
os: [ubuntu, macos]
perl: [ '5.38', '5.36', '5.34', '5.32', '5.30', '5.28', '5.26', '5.24', '5.22', '5.20', '5.18', '5.16', '5.14', '5.12', '5.10' ]
name: 🐪 Perl ${{ matrix.perl }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v4
- name: Setup Perl ${{ matrix.perl }}
uses: shogo82148/actions-setup-perl@v1
with: { perl-version: "${{ matrix.perl }}" }
- name: Install Dependencies
run: cpanm -vn Module::Build && cpanm -vn --installdeps --with-recommends .
- name: Run Tests
run: perl Build.PL ./Build && ./Build test
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Release
on:
push:
tags: [v*]
jobs:
release:
name: Release on CPAN and GitHub
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Setup Perl
uses: shogo82148/actions-setup-perl@v1
- name: Install Release Dependencies
run: cpanm -qn Module::Build CPAN::Uploader
- name: Package the Release
id: package
run: perl Build.PL && ./Build manifest && ./Build dist && echo "tarball=$(./Build tarball_name )" >> $GITHUB_OUTPUT
- name: Generate Release Changes
run: ./Build latest_changes
- name: Release on CPAN
env:
CPANUSER: ${{ secrets.CPAN_USERNAME }}
CPANPASS: ${{ secrets.CPAN_PASSWORD }}
run: cpan-upload --user "$CPANUSER" --password "$CPANPASS" '${{ steps.package.outputs.tarball }}'
- name: Create GitHub Release
id: release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body_path: latest_changes.md
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_path: ./${{ steps.package.outputs.tarball }}
asset_name: ${{ steps.package.outputs.tarball }}
asset_content_type: application/gzip
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@
/Build
.DS_Store
/Makefile*
/pm_to_blib
/latest_changes.md
.vscode/
28 changes: 27 additions & 1 deletion Build.PL
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,33 @@ use strict;
use warnings;
use Module::Build;

Module::Build->new(
my $class = Module::Build->subclass(
class => 'My::Builder',
code => q{
sub ACTION_tarball_name { print shift->dist_dir . ".tar.gz\n" }
sub ACTION_latest_changes {
my $self = shift;
(my $dv = $self->dist_version) =~ s/^v//;
open my $in, '<:raw', 'Changes' or die "Cannot open Changes: $!\n";
open my $out, '>:raw', 'latest_changes.md' or die "Cannot open latest_changes.md: $!\n";
while (<$in>) { last if /^\Q$dv\E\b/ }
print {$out} "Changes for v$dv\n";
while (<$in>) {
last if /^\s*$/;
chomp;
if (s/^\s+-/- /) {
print {$out} "\n";
} else {
s/^\s+/ /;
}
print {$out} $_;
}
$self->add_to_cleanup('latest_changes.md');
}
},
);

$class->new(
module_name => 'PGXN::API::Searcher',
license => 'perl',
create_makefile_pl => 'traditional',
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.SKIP
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# Avoid Module::Build generated and utility files.
\bBuild$
\b_build
^latest_changes\.md$

# Avoid temp and backup files.
~$
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PGXN/API/Search v0.10.3
=======================
PGXN/API/Searcher v0.10.3
=========================

This library's module, PGXN::API::Searcher, provides an interface to the
PGXN::API search engine index. You *must* have direct access to the index,
Expand Down

0 comments on commit 3a4e831

Please sign in to comment.