Skip to content

Commit

Permalink
use gh CLI instead of curl
Browse files Browse the repository at this point in the history
- delete any older dist tarballs
- move README update into version_increment
- use safer pod2markdown syntax
  • Loading branch information
msimerson committed Mar 13, 2024
1 parent 838256b commit d9756de
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .release/copyright_year.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ sed -i '' \

if ! repo_is_clean; then
git add .
git commit -m "bump copyright to $YEAR"
git commit -m "doc: bump copyright to $YEAR"
fi
5 changes: 1 addition & 4 deletions .release/do.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@

assure_changes_has_entry || exit

.release/copyright_year.sh
.release/version_increment.sh
.release/readme.sh
.release/copyright_year.sh
.release/update-psl.sh
.release/tag.sh
.release/publish-to-cpan.sh

git checkout -- META.json META.yml
14 changes: 13 additions & 1 deletion .release/publish-to-cpan.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
#!/bin/sh

if [ -n "$PERL_PUBLISH_SETUP" ]; then
perl -MCPAN -e 'install Module::Build'
perl -MCPAN -e 'install Mozilla::CA'
perl -MCPAN -e 'install CPAN::Uploader'
fi

for _f in Mail-DMARC-*;
do
echo "rm $_f"
rm $_f
done

perl Build.PL
./Build dist
./Build distclean
cpan-upload Mail-DMARC-*.tar.gz
./Build distclean
12 changes: 0 additions & 12 deletions .release/readme.sh

This file was deleted.

24 changes: 13 additions & 11 deletions .release/tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@ echo "tag $TAGNAME"
git tag "$TAGNAME"
git push --tags

# create a GitHub release
# https://developer.github.com/v3/repos/releases/#create-a-release
echo "hint: your GitHub OTP password"
# GitHub CLI api
# https://cli.github.com/manual/gh_api

curl -u msimerson -X POST https://api.github.com/repos/msimerson/mail-dmarc/releases -H 'Content-Type: application/json' -d "{
\"tag_name\": \"$TAGNAME\",
\"target_commitish\": \"master\",
\"name\": \"$TAGNAME\",
\"body\": \"Description of the release\",
\"draft\": true,
\"prerelease\": false
}"
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/msimerson/mail-dmarc/releases \
-f tag_name="$TAGNAME" \
-f target_commitish='master' \
-f name="$TAGNAME" \
-F draft=true \
-F prerelease=false \
-F generate_release_notes=true
2 changes: 1 addition & 1 deletion .release/update-psl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ curl -o share/public_suffix_list https://publicsuffix.org/list/effective_tld_nam

if ! repo_is_clean; then
git add share/public_suffix_list
git commit -m "PSL: updated"
git commit -m "chore: updated PSL"
fi
37 changes: 31 additions & 6 deletions .release/version_increment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,38 @@ assure_repo_is_clean || exit

NEWVER="$(get_version)"

# shellcheck disable=SC2046
sed -i '' \
-e "/VERSION =/ s/= .*$/= '$NEWVER';/" \
-e "/^version / s/.*/version $NEWVER/" \
$(find lib -type f -name '*.pm')
update_modules()
{
# shellcheck disable=SC2046
sed -i '' \
-e "/VERSION =/ s/= .*$/= '$NEWVER';/" \
-e "/^version / s/.*/version $NEWVER/" \
$(find lib -type f -name '*.pm')

git add lib
}

update_readme()
{
pod2markdown lib/Mail/DMARC.pm README.md
git add README.md
}

update_meta()
{
# update the version in META.* files
perl Build.PL
./Build distclean
git add META.*
}

update_modules
update_readme
update_meta

if ! repo_is_clean; then
git status
git add .
git commit -m "increment version to $NEWVER"
fi

git commit -m "release version $NEWVER"
11 changes: 2 additions & 9 deletions bin/install_deps.pl
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
use English qw( -no_match_vars );

my $apps = [
# { app => 'mysql-server-5', info => { port => 'mysql55-server', dport=>'mysql5', yum =>'mysql-server'} },
# { app => 'apache22' , info => { port => 'apache22', dport=>'', yum => 'httpd' } },
# { app => 'mysql-server-8', info => { port => 'mysql82-server', dport=>'mysql82', yum =>'mysql-server'} },
# { app => 'apache24' , info => { port => 'apache24', dport=>'', yum => 'httpd' } },
];

$EUID == 0 or die "You will have better luck if you run me as root.\n"; ## no critic (Carp)
Expand Down Expand Up @@ -353,13 +353,6 @@ sub is_freebsd_port_installed {
return 0;
}

sub get_freebsd_pkg_info {
if ( -x '/usr/sbin/pkg_info' ) {
return '/usr/sbin/pkg_info';
};
return;
}

sub get_freebsd_pkgng {
my $pkg = '/usr/local/sbin/pkg'; # port version is likely newest
if (! -x $pkg) { $pkg = '/usr/sbin/pkg'; }; # fall back
Expand Down

0 comments on commit d9756de

Please sign in to comment.