diff --git a/do-release.sh b/do-release.sh index 614c8f12c4..f276238301 100755 --- a/do-release.sh +++ b/do-release.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # Make sure, everything is English... @@ -15,7 +15,7 @@ if [ ! -f pom.xml -o ! -d ../pmd.github.io ]; then exit 1 fi - +LAST_VERSION= RELEASE_VERSION= DEVELOPMENT_VERSION= CURRENT_BRANCH= @@ -33,11 +33,16 @@ PATCH=$(echo $RELEASE_VERSION | cut -d . -f 3) if [ "$PATCH" == "0" ]; then NEXT_MINOR=$(expr ${MINOR} + 1) NEXT_PATCH="0" + LAST_MINOR=$(expr ${MINOR} - 1) + LAST_PATCH="0" else # this is a bugfixing release NEXT_MINOR="${MINOR}" NEXT_PATCH=$(expr ${PATCH} + 1) + LAST_MINOR="${MINOR}" + LAST_PATCH=$(expr ${PATCH} - 1) fi +LAST_VERSION="$MAJOR.$LAST_MINOR.$LAST_PATCH" DEVELOPMENT_VERSION="$MAJOR.$NEXT_MINOR.$NEXT_PATCH" DEVELOPMENT_VERSION="${DEVELOPMENT_VERSION}-SNAPSHOT" @@ -52,17 +57,18 @@ CURRENT_BRANCH=$(git symbolic-ref -q HEAD) CURRENT_BRANCH=${CURRENT_BRANCH##refs/heads/} CURRENT_BRANCH=${CURRENT_BRANCH:-HEAD} -echo "RELEASE_VERSION: ${RELEASE_VERSION}" -echo "DEVELOPMENT_VERSION: ${DEVELOPMENT_VERSION}" +echo "LAST_VERSION: ${LAST_VERSION}" +echo "RELEASE_VERSION: ${RELEASE_VERSION} (this release)" +echo "DEVELOPMENT_VERSION: ${DEVELOPMENT_VERSION} (the next version after the release)" echo "CURRENT_BRANCH: ${CURRENT_BRANCH}" echo echo "Is this correct?" echo -echo "Press enter to continue..." +echo "Press enter to continue... (or CTRL+C to cancel)" read - +export LAST_VERSION export RELEASE_VERSION export DEVELOPMENT_VERSION export CURRENT_BRANCH @@ -89,6 +95,26 @@ echo echo "Press enter to continue..." read + +# calculating stats for release notes + +STATS=$( +echo "### Stats" +echo "* $(git log pmd_releases/${LAST_VERSION}..HEAD --oneline --no-merges |wc -l) commits" +echo "* $(curl -s https://api.github.com/repos/pmd/pmd/milestones|jq ".[] | select(.title == \"$RELEASE_VERSION\") | .closed_issues") closed tickets & PRs" +echo "* Days since last release: $(( ( $(date +%s) - $(git log --max-count=1 --format="%at" pmd_releases/${LAST_VERSION}) ) / 86400))" +) + +TEMP_RELEASE_NOTES=$(cat docs/pages/release_notes.md) +TEMP_RELEASE_NOTES=${TEMP_RELEASE_NOTES/\{\% endtocmaker \%\}/$STATS$'\n'$'\n'\{\% endtocmaker \%\}$'\n'} +echo "${TEMP_RELEASE_NOTES}" > docs/pages/release_notes.md + +echo +echo "Updated stats in release notes:" +echo "$STATS" +echo +echo + # install bundles needed for rendering release notes bundle install --with=release_notes_preprocessing --path vendor/bundle diff --git a/docs/pages/pmd/projectdocs/committers/releasing.md b/docs/pages/pmd/projectdocs/committers/releasing.md index 0951ac7e16..f8966a7730 100644 --- a/docs/pages/pmd/projectdocs/committers/releasing.md +++ b/docs/pages/pmd/projectdocs/committers/releasing.md @@ -53,6 +53,25 @@ The designer lives at [pmd/pmd-designer](https://github.com/pmd/pmd-designer). Update property `pmd-designer.version` in **pom.xml** to reference the latest pmd-designer release. See for the available releases. +Starting with PMD 6.23.0 we'll provide small statistics for every release. This needs to be added +to the release notes as the last section. To count the closed issues and pull requests, the milestone +on github with the title of the new release is searched. Make sure, there is a milestone +on . The following snippet will +create the numbers, that can be attached to the release notes as a last section: + +```shell +LAST_VERSION=6.22.0 +NEW_VERSION=6.23.0 +NEW_VERSION_COMMITISH=HEAD + +echo "### Stats" +echo "* $(git log pmd_releases/${LAST_VERSION}..${NEW_VERSION_COMMITISH} --oneline --no-merges |wc -l) commits" +echo "* $(curl -s https://api.github.com/repos/pmd/pmd/milestones|jq ".[] | select(.title == \"$NEW_VERSION\") | .closed_issues") closed tickets & PRs" +echo "* Days since last release: $(( ( $(date +%s) - $(git log --max-count=1 --format="%at" pmd_releases/${LAST_VERSION}) ) / 86400))" +``` + +Note: this part is also integrated into `do-release.sh`. + Check in all (version) changes to branch master or any other branch, from which the release takes place: $ git commit -a -m "Prepare pmd release "