From 091dc0542ca80fcab52dc509c0d3339c9d1b7450 Mon Sep 17 00:00:00 2001 From: Justin Hawkins Date: Tue, 24 May 2022 18:23:57 +0930 Subject: [PATCH] Automate tags for release --- .goreleaser.yaml | 8 +++----- release_tag.pl | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 5 deletions(-) create mode 100755 release_tag.pl diff --git a/.goreleaser.yaml b/.goreleaser.yaml index e5e3581..48c06ae 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,11 +1,9 @@ -# This is an example .goreleaser.yml file with some sensible defaults. -# Make sure to check the documentation at https://goreleaser.com before: hooks: - # You may remove this if you don't use go modules. + # tag and push + - ./release_tag.pl + # clean up/install modules - go mod tidy - # you may remove this if you don't need go generate - - go generate ./... builds: - main: cmd/linkwallet/linkwallet.go env: diff --git a/release_tag.pl b/release_tag.pl new file mode 100755 index 0000000..d94813e --- /dev/null +++ b/release_tag.pl @@ -0,0 +1,14 @@ +#!/usr/bin/perl + +open my $fh, "<", "version/version.go" || die "oops"; +while (my $l = <$fh>) { + if ($l =~ m/const Tag = "(.+)"/) { + $tag = $1; + system ('git', 'tag', '-a', $tag, '-m', "version $tag for release") ; + die "could not tag?\n" if $? != 0; + system ('git', 'push', 'origin', $tag); + die "could not push tag?\n" if $? != 0; + } +} + +die "no version in version/version.go?\n"; \ No newline at end of file