From 9cb923d86dec6af01d4b4fc93ad1b03b1d18c794 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Mon, 6 May 2019 15:41:12 -0300 Subject: add publishrelease script --- publishrelease | 197 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 197 insertions(+) create mode 100755 publishrelease diff --git a/publishrelease b/publishrelease new file mode 100755 index 00000000..b464a852 --- /dev/null +++ b/publishrelease @@ -0,0 +1,197 @@ +#!/usr/bin/env bash + +[ "$1" ] || { + echo "usage.....: $0 " + echo "example...: $0 3.1.1" + echo + echo "Before running this, make sure the packages were built:" + echo " makedist 3.1.1 binary sign" + echo "And the tag was merged:" + echo " mergerelease 3.1.1" + echo + exit 1 +} + +####################################### +# preliminary checks +####################################### + +v="$1" + +git checkout v$v || { + echo "Could not checkout release tag." +} + +packages=( + luarocks-$v-windows-32.zip + luarocks-$v-windows-32.zip.asc + luarocks-$v-linux-x86_64.zip + luarocks-$v-linux-x86_64.zip.asc + luarocks-$v-win32.zip + luarocks-$v-win32.zip.asc + luarocks-$v.tar.gz + luarocks-$v.tar.gz.asc +) + +for f in "${packages[@]}" luarocks-$v-1.rockspec +do + [ -e "$f" ] || { + echo "Missing file $f" + exit 1 + } +done + +####################################### +# utility +####################################### + +function confirm() { + branch="$1" + + echo "****************************************" + git diff $branch + echo "****************************************" + git status + echo "****************************************" + + echo "Everything looks all right? (y/n)" + echo "(Answering y will commit and push)" + read + if ! [ "$REPLY" == "y" ] + then + git reset + git checkout . + git checkout master + exit 1 + fi +} + +####################################### +# gh-pages +####################################### + +git checkout gh-pages +git fetch origin gh-pages +git reset --hard origin/gh-pages + +cp "${packages[@]}" releases +cd releases +git add "${packages[@]}" +gawk ' +/add new release here/ { + print "" + print "" + print "luarocks-'$v'.tar.gzPGP signature" + print "luarocks-'$v'-windows-32.zip (luarocks.exe stand-alone Windows binary)PGP signature" + print "luarocks-'$v'-linux-x86_64.zip (luarocks stand-alone Linux x86_64 binary)PGP signature" + print "luarocks-'$v'-win32.zip (legacy Windows package, includes Lua 5.1)PGP signature" + done = 1 +} +// { + if (done == 1) { + done = 0 + } else { + print + } +} +' index.html > index.html.1 +mv index.html.1 index.html +git add index.html + +gawk ' +/^\[$/ { + go = 1 +} +// { + print + if (go == 1) { + go = 0 + + print "{" + print "\"'$v'\": {" + print "\"date\": \"'$(date +'%Y-%m-%d')'\"," + print "\"files\": [\"luarocks-'$v'.tar.gz\", \"luarocks-'$v'.tar.gz.asc\", \"luarocks-'$v'-win32.zip\", \"luarocks-'$v'-win32.zip.asc\", \"luarocks-'$v'-windows-32.zip\", \"luarocks-'$v'-windows-32.zip.asc\", \"luarocks-'$v'-linux-x86_64.zip\", \"luarocks-'$v'-linux-x86_64.zip.asc\"]," + print "\"about\": []" + print "}}," + } +} +' releases.json > releases.json.1 +mv releases.json.1 releases.json +git add releases.json + +confirm gh-pages + +git commit -av -m "Release $v" +git push + +####################################### +# luarocks.org +####################################### + +git checkout v$v + +luarocks upload luarocks-$v-1.rockspec + +git checkout master + +####################################### +# luarocks-site +####################################### + +if [ -e ../luarocks-site ] +then + cd ../luarocks-site +else + cd .. + git clone https://github.com/luarocks/luarocks-site + cd luarocks-site +fi + +git pull +sed -i 's,luarocks-[0-9]*\.[0-9]*\.[0-9]*,luarocks-'$v',' static/md/home.md +git add static/md/home.md + +confirm master + +git commit static/md/home.md -m "update front page for LuaRocks $v" +git push + +####################################### +# luarocks.wiki +####################################### + +[ -e ../luarocks.wiki ] || { + cd .. + git clone https://github.com/luarocks/luarocks.wiki.git +} + +if [ -e ../luarocks.wiki ] +then + cd ../luarocks.wiki +else + cd .. + git clone https://github.com/luarocks/luarocks.wiki.git + cd luarocks.wiki +fi + +sed -i "s,The current stable release is [^:]*:,The current stable release is '''$v''':," Download.mediawiki + +gawk ' +BEGIN { + print "'\'\'\''Version '$v\'\'\'' - '$(date +'%d/%b/%Y')' - [http://luarocks.org/releases/luarocks-'$v'.tar.gz All Unix] -" + print "[http://luarocks.org/releases/luarocks-'$v'-windows-32.zip Windows all-in-one executable]" + print "" +} +// { + print +} +' "Release-history.mediawiki" > "Release-history.mediawiki.1" +mv "Release-history.mediawiki.1" "Release-history.mediawiki" + +git add "Download.mediawiki" +git add "Release-history.mediawiki" + +confirm master + +git commit -av -m "Release $v" +git push -- cgit v1.2.3-55-g6feb