signrelease (1337B)
1 #!/bin/zsh 2 # 3 # shasum and sign release 4 5 KEY=B876CB44FA1B0274 6 SUM=sha256sum 7 8 { test -r "$1" } || { print "usage: signrelease [directory|tarball]"; return 0 } 9 10 target="$1" 11 12 { test -d "$target" } && { 13 14 pushd "$target" 15 for i in README.md INSTALL.md ChangeLog.md AUTHORS.md KNOWN_BUGS.md TODO.md; do 16 { test -r $i } && { 17 print "converting $i to .txt" 18 mv $i ${i%%.md}.txt } 19 # cat $i | markdown > ${i%%.md}.html 20 done 21 for i in COPYING LICENSE TODO README INSTALL ChangeLog AUTHORS KNOWN_BUGS; do 22 [[ -r $i ]] && { 23 print "converting $i to .txt" 24 mv $i ${i}.txt 25 } 26 done 27 28 # remove git dirs 29 { test -r .gitignore } && { rm -f .gitignore } 30 { test -d .git } && { rm -rf .git } 31 32 # generate configure 33 [[ -r configure.in ]] && autoreconf -i 34 [[ -r configure.ac ]] && autoreconf -i 35 36 # remove configure artifacts 37 [[ -r autom4te.cache ]] && rm -rf autom4te.cache 38 39 popd 40 41 print "packing tarball from dir $target" 42 tar cfz ${target}.tar.gz ${target} 43 target="$1.tar.gz" 44 } 45 46 { test -r "$target" } && { 47 print "making checksum of $target" 48 ${=SUM} "$target" > "$target.sha" 49 print "signing tarball with GnuPG key id $KEY" 50 gpg -b -a -u $KEY "$target" 51 } 52 53 print "Release done:" 54 ls -lh ${target} 55 cat ${target}.sha