File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,17 +46,40 @@ namespace 'release' do
4646 SUPPORTED . each do |os , arch |
4747 output_dir = "#{ OUTDIR } /#{ os } _#{ arch } "
4848 build_for_platform ( os , arch , out : "#{ output_dir } /#{ PROGNAME } " )
49- sh "tar czf #{ OUTDIR } /#{ os } _#{ arch } .tar.gz -C #{ OUTDIR } #{ os } _#{ arch } "
49+
50+ version = get_version
51+ sh "tar czf #{ OUTDIR } /gitwho_#{ version } _#{ os } _#{ arch } .tar.gz " \
52+ "-C #{ OUTDIR } #{ os } _#{ arch } "
5053 end
5154 end
55+
56+ desc 'Sign checksum of built artifacts'
57+ task :sign do
58+ FileUtils . cd ( OUTDIR ) do
59+ version = get_version
60+ sumsfile = "SHA2-256SUMS_#{ version } .txt"
61+ sh "shasum -a 256 **/git-who > #{ sumsfile } "
62+ sh "ssh-keygen -Y sign -n file -f ~/.ssh/gitwho_ed25519 #{ sumsfile } "
63+ end
64+ end
65+
66+ task all : [ :build , :sign ]
5267end
5368
5469CLOBBER . include ( OUTDIR )
5570CLOBBER . include ( PROGNAME )
5671
72+ def get_version ( )
73+ `git describe --tags --always --dirty` . strip
74+ end
75+
76+ def get_commit ( )
77+ `git rev-parse --short HEAD` . strip
78+ end
79+
5780def build_for_platform ( goos , goarch , out : PROGNAME )
58- rev = `git rev-parse --short HEAD` . strip
59- version = `git describe --tags --always --dirty` . strip
81+ version = get_version
82+ rev = get_commit
6083 sh "GOOS=#{ goos } GOARCH=#{ goarch } go build -a -o #{ out } " \
6184 "-ldflags '-s -w -X main.Commit=#{ rev } -X main.Version=#{ version } '"
6285end
You can’t perform that action at this time.
0 commit comments