From 303ac2391cf97de3d82da29460b9f8cff9fb6cf7 Mon Sep 17 00:00:00 2001 From: jonasbn Date: Wed, 5 Jun 2024 20:31:52 +0200 Subject: [PATCH] Added helper tool for making releases --- .perlcriticrc | 13 ++++++++++ scripts/build.pl | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 .perlcriticrc create mode 100755 scripts/build.pl diff --git a/.perlcriticrc b/.perlcriticrc new file mode 100644 index 00000000..02a0a572 --- /dev/null +++ b/.perlcriticrc @@ -0,0 +1,13 @@ +[InputOutput::RequireCheckedSyscalls] +functions = :builtins +exclude_functions = print say + +[-Modules::RequireVersionVar] + +[CodeLayout::RequireTidyCode] + +[-Miscellanea::ProhibitUselessNoCritic] + +[-ValuesAndExpressions::ProhibitVersionStrings] + +[-ErrorHandling::RequireCarping] diff --git a/scripts/build.pl b/scripts/build.pl new file mode 100755 index 00000000..7ce3a531 --- /dev/null +++ b/scripts/build.pl @@ -0,0 +1,62 @@ +#!/usr/bin/env perl + +use warnings; +use strict; +use v5.10.0; + +my $version = $ARGV[0]; + +if (not $version) { + die 'Usage build.pl '; +} + +say "Building Docker images for version: $version"; + +my @targets = qw(v0 latest); + +push @targets, $version; + +say 'Building Docker images for amd64 architecture'; + +my $counter = 0; +my $total = scalar @targets; + +foreach my $target (@targets) { + say "Building $target ($counter/$total)"; + system "docker build --platform linux/amd64 --tag jonasbn/github-action-spellcheck:$target ."; + $counter++; +} + +$counter = 0; + +say "Pushing Docker images to DockerHub"; +foreach my $target (@targets) { + say "Pushing $target ($counter/$total)"; + system "docker push jonasbn/github-action-spellcheck:$target"; + $counter++; +} + +# Updating the v0 tag +say 'Deleting existing tag v0 locally'; +say 'git tag --delete v0'; +system 'git tag --delete v0'; + +say 'Deleting existing tag v0 remotely'; +say 'git push --delete origin v0'; +system 'git push --delete origin v0'; + +say 'Tagging also as v0'; +say 'git tag --annotate v0 --message "Tagging v0"'; +system 'git tag --annotate v0 --message "Tagging v0"'; + +# Pushing tags +say 'Pushing tags'; +say 'git push --tags'; +system 'git push --tags'; + +# The tagging of the version number is a part of the release process, so not need +# to tag create this tag separately +say 'Creating release on GitHub with auto generated release notes and discussion'; +system "gh release create $version --discussion-category 'General' --generate-notes"; + +exit 0;