2015-09-18 11:25:30 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-05-27 20:33:03 +02:00
|
|
|
# Make sure, everything is English...
|
|
|
|
export LANG=C.UTF8
|
|
|
|
|
2015-09-18 11:25:30 +02:00
|
|
|
# verify the current directory
|
|
|
|
if [ ! -f pom.xml -o ! -d ../pmd.github.io ]; then
|
2016-01-07 10:14:24 +01:00
|
|
|
echo "You seem to be in the wrong working directory or you don't have pmd.github.io checked out..."
|
2015-09-18 11:25:30 +02:00
|
|
|
echo
|
|
|
|
echo "Expected:"
|
|
|
|
echo "* You are currently in the pmd repository"
|
|
|
|
echo "* ../pmd.github.io is the pmd.github.io repository"
|
|
|
|
echo
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
RELEASE_VERSION=
|
|
|
|
DEVELOPMENT_VERSION=
|
|
|
|
CURRENT_BRANCH=
|
|
|
|
|
|
|
|
echo "-------------------------------------------"
|
|
|
|
echo "Releasing PMD"
|
|
|
|
echo "-------------------------------------------"
|
|
|
|
|
2017-02-25 20:07:37 +01:00
|
|
|
# see also https://gist.github.com/pdunnavant/4743895
|
2017-12-15 15:05:21 +01:00
|
|
|
CURRENT_VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec)
|
2017-02-25 20:07:37 +01:00
|
|
|
RELEASE_VERSION=${CURRENT_VERSION%-SNAPSHOT}
|
2017-05-20 22:21:55 +02:00
|
|
|
MAJOR=$(echo $RELEASE_VERSION | cut -d . -f 1)
|
|
|
|
MINOR=$(echo $RELEASE_VERSION | cut -d . -f 2)
|
|
|
|
PATCH=$(echo $RELEASE_VERSION | cut -d . -f 3)
|
2017-07-01 18:56:33 +02:00
|
|
|
if [ "$PATCH" == "0" ]; then
|
|
|
|
NEXT_MINOR=$(expr ${MINOR} + 1)
|
|
|
|
NEXT_PATCH="0"
|
|
|
|
else
|
|
|
|
# this is a bugfixing release
|
|
|
|
NEXT_MINOR="${MINOR}"
|
|
|
|
NEXT_PATCH=$(expr ${PATCH} + 1)
|
|
|
|
fi
|
|
|
|
DEVELOPMENT_VERSION="$MAJOR.$NEXT_MINOR.$NEXT_PATCH"
|
2017-02-25 20:07:37 +01:00
|
|
|
DEVELOPMENT_VERSION="${DEVELOPMENT_VERSION}-SNAPSHOT"
|
|
|
|
|
2018-01-21 16:22:59 +01:00
|
|
|
# allow to override the next version, e.g. via "NEXT_VERSION=7.0.0 ./do-release.sh"
|
|
|
|
if [ "$NEXT_VERSION" != "" ]; then
|
|
|
|
DEVELOPMENT_VERSION="${NEXT_VERSION}-SNAPSHOT"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2017-02-25 20:07:37 +01:00
|
|
|
# http://stackoverflow.com/questions/1593051/how-to-programmatically-determine-the-current-checked-out-git-branch
|
|
|
|
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 "CURRENT_BRANCH: ${CURRENT_BRANCH}"
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "Is this correct?"
|
|
|
|
echo
|
|
|
|
echo "Press enter to continue..."
|
|
|
|
read
|
2015-09-18 11:25:30 +02:00
|
|
|
|
|
|
|
|
|
|
|
export RELEASE_VERSION
|
|
|
|
export DEVELOPMENT_VERSION
|
|
|
|
export CURRENT_BRANCH
|
|
|
|
|
2018-05-30 09:01:00 +02:00
|
|
|
RELEASE_RULESET="pmd-core/src/main/resources/rulesets/releases/${RELEASE_VERSION//\./}.xml"
|
|
|
|
|
2017-08-15 14:08:48 +02:00
|
|
|
echo "* Update version/release info in **docs/pages/release_notes.md**."
|
2015-09-18 11:25:30 +02:00
|
|
|
echo
|
|
|
|
echo " ## $(date -u +%d-%B-%Y) - ${RELEASE_VERSION}"
|
|
|
|
echo
|
2018-01-21 16:22:59 +01:00
|
|
|
echo "* Update date info in **docs/_config.yml**."
|
2017-12-15 15:27:57 +01:00
|
|
|
echo
|
2015-09-18 11:25:30 +02:00
|
|
|
echo "* Ensure all the new rules are listed in a the proper file:"
|
2018-05-30 09:01:00 +02:00
|
|
|
echo " ${RELEASE_RULESET}"
|
2015-09-18 11:25:30 +02:00
|
|
|
echo
|
2017-12-15 15:27:57 +01:00
|
|
|
echo "* Update **../pmd.github.io/_config.yml** to mention the new release"
|
|
|
|
echo
|
2018-04-29 09:48:03 +02:00
|
|
|
echo "* Add **../pmd.github.io/_posts/$(date -u +%Y-%m-%d)-PMD-${RELEASE_VERSION}.md"
|
2015-09-18 11:25:30 +02:00
|
|
|
echo
|
|
|
|
echo "Press enter to continue..."
|
|
|
|
read
|
|
|
|
echo "Committing current changes (pmd)"
|
2018-05-29 17:11:40 -03:00
|
|
|
|
2018-05-30 09:01:00 +02:00
|
|
|
if [[ -e ${RELEASE_RULESET} ]]
|
|
|
|
then
|
|
|
|
git add ${RELEASE_RULESET}
|
2018-05-29 17:11:40 -03:00
|
|
|
fi
|
|
|
|
|
2015-09-18 11:25:30 +02:00
|
|
|
git commit -a -m "Prepare pmd release ${RELEASE_VERSION}"
|
|
|
|
(
|
|
|
|
echo "Committing current changes (pmd.github.io)"
|
|
|
|
cd ../pmd.github.io
|
2018-02-25 10:04:45 +01:00
|
|
|
git add _posts/$(date -u +%Y-%m-%d)-PMD-${RELEASE_VERSION}.md
|
2015-09-18 11:25:30 +02:00
|
|
|
git commit -a -m "Prepare pmd release ${RELEASE_VERSION}"
|
2017-02-25 20:07:37 +01:00
|
|
|
git push
|
2015-09-18 11:25:30 +02:00
|
|
|
)
|
|
|
|
|
2017-05-05 11:17:25 +02:00
|
|
|
./mvnw -B release:clean release:prepare \
|
2015-09-18 11:25:30 +02:00
|
|
|
-Dtag=pmd_releases/${RELEASE_VERSION} \
|
|
|
|
-DreleaseVersion=${RELEASE_VERSION} \
|
2017-02-25 20:07:37 +01:00
|
|
|
-DdevelopmentVersion=${DEVELOPMENT_VERSION}
|
2015-09-18 11:25:30 +02:00
|
|
|
|
|
|
|
|
|
|
|
echo
|
2017-02-25 20:07:37 +01:00
|
|
|
echo "Tag has been pushed.... now check travis build: <https://travis-ci.org/pmd/pmd>"
|
2015-09-18 11:25:30 +02:00
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo "Submit news to SF on <https://sourceforge.net/p/pmd/news/> page. You can use"
|
|
|
|
echo "the following template:"
|
|
|
|
echo
|
|
|
|
cat <<EOF
|
|
|
|
PMD ${RELEASE_VERSION} released
|
|
|
|
|
|
|
|
* Downloads: https://github.com/pmd/pmd/releases/tag/pmd_releases%2F${RELEASE_VERSION}
|
|
|
|
* Documentation: https://pmd.github.io/pmd-${RELEASE_VERSION}/
|
2018-02-25 12:05:56 +01:00
|
|
|
|
|
|
|
And Copy-Paste the release notes
|
2015-09-18 11:25:30 +02:00
|
|
|
EOF
|
|
|
|
echo
|
|
|
|
echo "Press enter to continue..."
|
|
|
|
read
|
|
|
|
|
|
|
|
echo
|
2018-02-25 12:05:56 +01:00
|
|
|
echo "Check the milestone on github:"
|
|
|
|
echo "<https://github.com/pmd/pmd/milestones>"
|
|
|
|
echo " --> move any open issues to the next milestone, close the current milestone"
|
|
|
|
echo " --> Maybe there are some milestones on sourceforge, too: <https://sourceforge.net/p/pmd/bugs/milestones>."
|
2015-09-18 11:25:30 +02:00
|
|
|
echo
|
2017-02-25 20:07:37 +01:00
|
|
|
echo
|
|
|
|
echo "Prepare Next development version:"
|
2018-01-21 16:51:52 +01:00
|
|
|
echo "* Update version/date info in **docs/_config.yml**."
|
2015-09-18 11:25:30 +02:00
|
|
|
echo
|
2018-05-29 16:08:48 -03:00
|
|
|
echo
|
|
|
|
echo "Press enter to continue..."
|
|
|
|
read
|
|
|
|
|
2018-05-29 17:42:27 -03:00
|
|
|
# update release_notes_old
|
2018-05-30 09:01:00 +02:00
|
|
|
OLD_RELEASE_NOTES=$(tail -n +8 docs/pages/release_notes_old.md)
|
2018-05-29 17:42:27 -03:00
|
|
|
NEW_RELEASE_NOTES=$(tail -n +6 docs/pages/release_notes.md)
|
2018-05-30 09:01:00 +02:00
|
|
|
echo "$(head -n 7 docs/pages/release_notes_old.md)" > docs/pages/release_notes_old.md
|
2018-05-29 17:42:27 -03:00
|
|
|
echo "$NEW_RELEASE_NOTES" >> docs/pages/release_notes_old.md
|
2018-05-30 09:01:00 +02:00
|
|
|
echo >> docs/pages/release_notes_old.md
|
2018-05-29 17:42:27 -03:00
|
|
|
echo "$OLD_RELEASE_NOTES" >> docs/pages/release_notes_old.md
|
|
|
|
|
2018-05-29 16:08:48 -03:00
|
|
|
# reset release notes template
|
|
|
|
cat > docs/pages/release_notes.md <<EOF
|
2017-08-15 14:08:48 +02:00
|
|
|
---
|
|
|
|
title: PMD Release Notes
|
|
|
|
permalink: pmd_release_notes.html
|
|
|
|
keywords: changelog, release notes
|
|
|
|
---
|
2015-09-18 11:25:30 +02:00
|
|
|
|
|
|
|
## ????? - ${DEVELOPMENT_VERSION}
|
|
|
|
|
2017-02-25 20:07:37 +01:00
|
|
|
The PMD team is pleased to announce PMD ${DEVELOPMENT_VERSION%-SNAPSHOT}.
|
|
|
|
|
2018-05-24 08:30:07 +02:00
|
|
|
This is a minor release.
|
2015-09-18 11:25:30 +02:00
|
|
|
|
2017-02-25 20:07:37 +01:00
|
|
|
### Table Of Contents
|
2015-09-18 11:25:30 +02:00
|
|
|
|
2017-08-15 14:08:48 +02:00
|
|
|
* [New and noteworthy](#new-and-noteworthy)
|
|
|
|
* [Fixed Issues](#fixed-issues)
|
|
|
|
* [API Changes](#api-changes)
|
|
|
|
* [External Contributions](#external-contributions)
|
2015-09-18 11:25:30 +02:00
|
|
|
|
2017-02-25 20:07:37 +01:00
|
|
|
### New and noteworthy
|
2015-09-18 11:25:30 +02:00
|
|
|
|
2017-02-25 20:07:37 +01:00
|
|
|
### Fixed Issues
|
2015-09-18 11:25:30 +02:00
|
|
|
|
2017-02-25 20:07:37 +01:00
|
|
|
### API Changes
|
|
|
|
|
|
|
|
### External Contributions
|
2015-09-18 11:25:30 +02:00
|
|
|
|
|
|
|
EOF
|
2018-05-29 16:08:48 -03:00
|
|
|
|
2015-09-18 11:25:30 +02:00
|
|
|
git commit -a -m "Prepare next development version"
|
2017-02-25 20:07:37 +01:00
|
|
|
git push origin ${CURRENT_BRANCH}
|
2018-06-26 09:44:02 +02:00
|
|
|
./mvnw -B release:clean
|
2015-09-18 11:25:30 +02:00
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo
|
2017-02-25 20:07:37 +01:00
|
|
|
echo "Verify the new release on github: <https://github.com/pmd/pmd/releases/tag/pmd_releases/${RELEASE_VERSION}>"
|
2015-09-18 11:25:30 +02:00
|
|
|
echo
|
|
|
|
echo
|
2017-02-25 21:12:18 +01:00
|
|
|
echo "Send out an announcement mail to the mailing list:"
|
|
|
|
echo "To: PMD Developers List <pmd-devel@lists.sourceforge.net>"
|
2017-02-25 20:07:37 +01:00
|
|
|
echo "Subject: [ANNOUNCE] PMD ${RELEASE_VERSION} Released"
|
2018-02-25 12:05:56 +01:00
|
|
|
echo
|
|
|
|
echo " * Downloads: https://github.com/pmd/pmd/releases/tag/pmd_releases%2F${RELEASE_VERSION}"
|
|
|
|
echo " * Documentation: https://pmd.github.io/pmd-${RELEASE_VERSION}/"
|
|
|
|
echo
|
|
|
|
echo " And Copy-Paste the release notes"
|
|
|
|
echo
|
2017-02-25 20:07:37 +01:00
|
|
|
echo
|
2015-09-18 11:25:30 +02:00
|
|
|
echo
|
|
|
|
echo "------------------------------------------"
|
|
|
|
echo "Done."
|
|
|
|
echo "------------------------------------------"
|
|
|
|
echo
|
|
|
|
|
|
|
|
|
2017-02-25 20:07:37 +01:00
|
|
|
|