#!/bin/bash
# work around a maven-scm bug with git while releasing
# this might also be necessary: git config --add status.displayCommentPrefix true
# see https://jira.codehaus.org/browse/SCM-740
export LANG=C
export MAVEN_OPTS="-XX:MaxPermSize=1g"
# check setup
if [ "" = "$PMD_SF_USER" ]; then
echo "No env variable PMD_SF_USER specified. This is the sourceforge account name needed"
echo "during the release process to upload files via ssh/scp/rsync."
echo
echo "Please set the variable, e.g. in your ~/.bashrc:"
echo
echo "PMD_SF_USER=sfuser"
echo "export PMD_SF_USER"
echo
exit 1
fi
if [ "" = "$PMD_GPG_PROFILE" ]; then
echo "No env variable PMD_GPG_PROFILE specified. This is your maven profile, which configures"
echo "the properties gpg.keyname and gpg.passphrase used"
echo "to sign the created release artifacts before uploading to maven central."
echo
echo "Please set the variable, e.g. in your ~/.bashrc:"
echo
echo "PMD_GPG_PROFILE=pmd-gpg"
echo "export PMD_GPG_PROFILE"
echo
echo "And in your ~/.m2/settings.xml file:"
echo
echo " "
echo " "
echo " pmd-gpg"
echo " "
echo " AB123CDE"
echo " "
echo " "
echo " "
echo " "
echo " Close and Release the staging repository"
echo " Check here: "
echo
echo "Press enter to continue..."
read
echo
echo "Creating the pmd-doc-${RELEASE_VERSION}.zip archive..."
(
cd target
mv staging pmd-doc-${RELEASE_VERSION}
zip -r pmd-doc-${RELEASE_VERSION}.zip pmd-doc-${RELEASE_VERSION}/
)
echo
echo "Adding the site to pmd.github.io..."
rsync -avhP target/pmd-doc-${RELEASE_VERSION}/ ../../../pmd.github.io/pmd-${RELEASE_VERSION}/
(
cd ../../../pmd.github.io
git add pmd-${RELEASE_VERSION}
git commit -m "Added pmd-${RELEASE_VERSION}"
)
echo
echo "Uploading the zip files..."
rsync -avhP pmd-dist/target/pmd-*-${RELEASE_VERSION}.zip target/pmd-doc-${RELEASE_VERSION}.zip $PMD_SF_USER@web.sourceforge.net:/home/frs/project/pmd/pmd/${RELEASE_VERSION}/
rsync -avhP src/site/markdown/overview/changelog.md $PMD_SF_USER@web.sourceforge.net:/home/frs/project/pmd/pmd/${RELEASE_VERSION}/ReadMe.md
echo
if [ ! "" = "$PMD_LOCAL_BINARIES" -a -d $PMD_LOCAL_BINARIES ]; then
echo "Copying the files to local storage directory $PMD_LOCAL_BINARIES..."
cp -av pmd-dist/target/pmd-*-${RELEASE_VERSION}.zip target/pmd-doc-${RELEASE_VERSION}.zip $PMD_LOCAL_BINARIES
echo
fi
echo
echo "Verify the md5sums: "
md5sum pmd-dist/target/pmd-*-${RELEASE_VERSION}.zip target/pmd-doc-${RELEASE_VERSION}.zip
echo
echo "and make the new binary pmd zip file the default download for all platforms."
echo
echo "Press enter to continue..."
read
)
echo
echo "Submit news to SF on page. You can use"
echo "the following template:"
echo
cat <"
echo
echo "Press enter to continue..."
read
echo "Last step - next development version:"
echo "* Move version/release info from **src/site/markdown/overview/changelog.md** to **src/site/markdown/overview/changelog-old.md**."
echo "* Update version/release info in **src/site/markdown/overview/changelog.md**."
echo "* Update pmd-{java8,ui}/pom.xml - the version is probably wrong - set it to the parent's=next development version: ${DEVELOPMENT_VERSION}."
echo
cat <"
echo
echo " * Set the title: PMD ${RELEASE_VERSION} ($(date -u +%d-%B-%Y))"
echo " * copy/paste the changelog.md"
echo " * Upload the binary zip file"
echo " * Upload the doc zip file"
echo
echo "Press enter to continue..."
read
echo
echo "------------------------------------------"
echo "Done."
echo "------------------------------------------"
echo