From: Florian Zschocke Date: Sun, 26 Jan 2020 18:50:58 +0000 (+0100) Subject: Adjust `release.template` for publishing releases on GitHub X-Git-Tag: r1.9.0~7^2~14 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=af7b0e30b76dede75f70995ca935ae59cf3a4b2e;p=gitblit.git Adjust `release.template` for publishing releases on GitHub The major change is switching from `publishBinaries`, which still exists and uploads to Bintray, to `releaseBinaries`, which creates a draft release on GitHub and uploads the binaries. Another change is some reordering. Now first the binaries are uploaded, the maven artifacts pubished and the tag and site pages pushed. Then the GitHub release is made public. Only after that is the minor version bumped and pushed. The whole script could use some error checking and stoping when things go wrong, instead of blindly continuing. A minor change, and temporary, is that we need and check for Ant 1.9, as we still build with Java 7. --- diff --git a/release.template b/release.template index 13225190..9ea951a9 100644 --- a/release.template +++ b/release.template @@ -3,6 +3,28 @@ # ${project.version} release script # +# In order to build on CI systems, we need to make sure we have a Ant +# that we can use. Ant 1.10 requires Java 8, so we cannot use it for +# the current version. Instead, Moxie can be used if present. +if command -v ant 2> /dev/null 1>&2 ; then + if ant -version 2> /dev/null ; then + antCmd=ant + fi +fi +if [ -z "$antCmd" ] ; then + if command -v moxie 2> /dev/null 1>&2 ; then + antCmd=moxie + fi +fi +if [ -z "$antCmd" ] ; then + echo "Cannot find suitable ant or moxie. No build is possible." + exit 1 +fi + +# Check which branch we are on, so we can run this script not only on master +branch=$(git symbolic-ref -q --short HEAD) + + # ensure Maven repository is up-to-date echo "" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" @@ -14,13 +36,13 @@ git checkout gh-pages git pull cd ${project.directory} -# go back one commit to RELEASE commit +# go back one commit to RELEASE commit (fzs: what, why? Let's go to the tag) echo "" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" -echo "Checking out ${project.version} RELEASE commit ${project.commitId}" +echo "Checking out ${project.version} RELEASE commit ${project.tag}" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "" -git checkout ${project.commitId} +git checkout ${project.tag} # build RELEASE artifacts echo "" @@ -28,7 +50,7 @@ echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Building ${project.version} RELEASE artifacts" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "" -ant clean buildAll buildMavenArtifacts +$antCmd clean buildAll buildMavenArtifacts # commit all generated artifacts and metadata echo "" @@ -47,39 +69,41 @@ echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Uploading ${project.version} artifacts" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "" -ant publishBinaries +$antCmd releaseBinaries -# build site, update gh-pages, and ftp upload site to hosting provider +# push Maven repository to origin echo "" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" -echo "Building ${project.version} website" +echo "Pushing Maven repository" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "" -ant publishSite +cd ${maven.directory} +git push origin gh-pages +cd ${project.directory} -# merge to master +# push project branches echo "" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" -echo "Updating build identifier for next release cycle" +echo "Pushing master, gh-pages, and tag ${project.tag}" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "" -git checkout master -ant nextPointReleaseCycle +git push origin gh-pages ${project.tag} -# push Maven repository to origin +# publish release draft echo "" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" -echo "Pushing Maven repository" +echo "Publishing release ${project.version}" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "" -cd ${maven.directory} -git push origin gh-pages -cd ${project.directory} +$antCmd publishRelease -# push project branches +# merge to master (fzs: what? why merging?) echo "" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" -echo "Pushing master, gh-pages, and tag ${project.tag}" +echo "Updating build identifier for next release cycle" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "" -git push origin master gh-pages ${project.tag} +git checkout ${branch} +$antCmd nextPointReleaseCycle +git push origin +