From 848a0761fee84d850ecdbc87c46ed833a68bf135 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sun, 2 Sep 2018 14:51:23 +0200 Subject: [PATCH] Fix release scripts * fix language var LANG * fix bundle install command * automate creation of release notes post in pmd.github.io * add var "is_release_notes_processor" * Always install the gems for rendering release notes --- .travis.yml | 2 +- .travis/build-coveralls.sh | 2 +- .travis/build-doc.sh | 2 +- .travis/build-sonar.sh | 2 +- .travis/release.sh | 3 --- Gemfile | 4 +++- do-release.sh | 22 +++++++++++----------- 7 files changed, 18 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index b93ad42d2a..684b34f79b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -52,7 +52,7 @@ before_install: install: - . ./install-jdk.sh -F 11 -L GPL -W $HOME/jdk - gem install bundler - - bundle install --without=release_notes_preprocessing + - bundle install --with=release_notes_preprocessing before_script: true script: source .travis/build-$BUILD.sh after_success: true diff --git a/.travis/build-coveralls.sh b/.travis/build-coveralls.sh index 0b9a82ec3d..b58629a5fa 100755 --- a/.travis/build-coveralls.sh +++ b/.travis/build-coveralls.sh @@ -4,7 +4,7 @@ set -e source .travis/logger.sh source .travis/common-functions.sh -VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec | tail -1) +VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec) log_info "Building PMD Coveralls.io report ${VERSION} on branch ${TRAVIS_BRANCH}" if ! travis_isPush; then diff --git a/.travis/build-doc.sh b/.travis/build-doc.sh index f340a42c61..e4ec9c9a9b 100755 --- a/.travis/build-doc.sh +++ b/.travis/build-doc.sh @@ -4,7 +4,7 @@ set -e source .travis/logger.sh source .travis/common-functions.sh -VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec | tail -1) +VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec) log_info "Building PMD Documentation ${VERSION} on branch ${TRAVIS_BRANCH}" if ! travis_isPush; then diff --git a/.travis/build-sonar.sh b/.travis/build-sonar.sh index de418876db..7e51aaf46d 100755 --- a/.travis/build-sonar.sh +++ b/.travis/build-sonar.sh @@ -4,7 +4,7 @@ set -e source .travis/logger.sh source .travis/common-functions.sh -VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec | tail -1) +VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec) log_info "Building PMD Sonar ${VERSION} on branch ${TRAVIS_BRANCH}" if ! travis_isPush; then diff --git a/.travis/release.sh b/.travis/release.sh index 883f9721d4..2565125c88 100755 --- a/.travis/release.sh +++ b/.travis/release.sh @@ -28,9 +28,6 @@ if [ "${BUILD}" = "deploy" ]; then true ) -# install the gems required for rendering the release notes -bundle install --with=release_notes_preprocessing - # renders, and skips the first 6 lines - the Jekyll front-matter RENDERED_RELEASE_NOTES=$(bundle exec .travis/render_release_notes.rb docs/pages/release_notes.md | tail -n +6) diff --git a/Gemfile b/Gemfile index ed76d93bfe..4894455d47 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,9 @@ source 'https://rubygems.org/' gem 'pmdtester', '~> 1.0.0.pre.beta3' gem 'danger', '~> 5.6', '>= 5.6' -# This group is only needed during release (via .travis/release.sh and do-release.sh) +# This group is only needed for rendering release notes +# this happens during release (.travis/release.sh and do-release.sh) +# but also during regular builds (.travis/build-deploy.sh) group :release_notes_preprocessing do gem 'liquid', '>=4.0.0' gem 'safe_yaml', '>=1.0' diff --git a/do-release.sh b/do-release.sh index e98ab9ec92..38aab524e3 100755 --- a/do-release.sh +++ b/do-release.sh @@ -1,7 +1,7 @@ #!/bin/bash # Make sure, everything is English... -export LANG=C.UTF8 +export LANG=C.UTF-8 # verify the current directory if [ ! -f pom.xml -o ! -d ../pmd.github.io ]; then @@ -62,15 +62,19 @@ echo "Press enter to continue..." read -# install bundles needed for rendering release notes -bundle install with=release_notes_preprocessing --path vendor/bundle - - export RELEASE_VERSION export DEVELOPMENT_VERSION export CURRENT_BRANCH + +# install bundles needed for rendering release notes +bundle install --with=release_notes_preprocessing --path vendor/bundle + RELEASE_RULESET="pmd-core/src/main/resources/rulesets/releases/${RELEASE_VERSION//\./}.xml" +export RELEASE_NOTES_POST="_posts/$(date -u +%Y-%m-%d)-PMD-${RELEASE_VERSION}.md" +echo "Generating ../pmd.github.io/${RELEASE_NOTES_POST}..." +NEW_RELEASE_NOTES=$(bundle exec .travis/render_release_notes.rb docs/pages/release_notes.md | tail -n +6) +echo "${NEW_RELEASE_NOTES}" > ../pmd.github.io/${RELEASE_NOTES_POST} echo "* Update date info in **docs/_config.yml**." echo " date: $(date -u +%d-%B-%Y)" @@ -80,8 +84,6 @@ echo " ${RELEASE_RULESET}" echo echo "* Update **../pmd.github.io/_config.yml** to mention the new release" echo -echo "* Add **../pmd.github.io/_posts/$(date -u +%Y-%m-%d)-PMD-${RELEASE_VERSION}.md" -echo echo "Press enter to continue..." read echo "Committing current changes (pmd)" @@ -95,7 +97,7 @@ git commit -a -m "Prepare pmd release ${RELEASE_VERSION}" ( echo "Committing current changes (pmd.github.io)" cd ../pmd.github.io - git add _posts/$(date -u +%Y-%m-%d)-PMD-${RELEASE_VERSION}.md + git add ${RELEASE_NOTES_POST} git commit -a -m "Prepare pmd release ${RELEASE_VERSION}" git push ) @@ -117,7 +119,6 @@ echo echo "Check the milestone on github:" echo "" echo " --> move any open issues to the next milestone, close the current milestone" -echo " --> Maybe there are some milestones on sourceforge, too: ." echo echo echo "Prepare Next development version:" @@ -129,7 +130,6 @@ read # update release_notes_old OLD_RELEASE_NOTES=$(tail -n +8 docs/pages/release_notes_old.md) -NEW_RELEASE_NOTES=$(bundle exec .travis/render_release_notes.rb docs/pages/release_notes.md | tail -n +6) echo "$(head -n 7 docs/pages/release_notes_old.md)" > docs/pages/release_notes_old.md echo "$NEW_RELEASE_NOTES" >> docs/pages/release_notes_old.md echo >> docs/pages/release_notes_old.md @@ -149,7 +149,7 @@ The PMD team is pleased to announce PMD {{ site.pmd.version }}. This is a {{ site.pmd.release_type }} release. -{% tocmaker %} +{% tocmaker is_release_notes_processor %} ### New and noteworthy