How to make a release

Roman Ivanov edited this page Jun 30, 2018 · 281 revisions

Content

Pre-reqs

Follow Sonatype setup, this includes :

  • Setup JIRA account, link, and request write access to repository (example).
  • Create a GPG key set and upload (example)
  • Setup ~/.m2/settings.xml to include the servers (instructions). Follow Maven guide on how to encrypt passwords
<settings>
..... 
    <servers>
        <server>
            <id>sonatype-nexus-snapshots</id>
            <username>romanivanov</username>
            <password>password</password>
        </server>
        <server>
            <id>sonatype-nexus-staging</id>
            <username>romanivanov</username>
            <password>password</password>
        </server>
        <server>
            <id>sourceforge-new-site</id>
            <username>romanivanov</username>
            <password>password</password>
        </server>
    </servers>

    <profiles>
      <profile>
          <!-- "mvn release:prepare .... -Pgpg"
               and it is possible to skip " -Dgpg.passphrase=xxxx" at "-Darguments"
               Use "gpg \-\-list-keys", "pub   1024D/C6EED57A 2010-01-13"
                    to get "gpg.keyname" in example it is  value "C6EED57A"
          -->
          <id>gpg</id>
          <properties>
              <gpg.passphrase>your_passphase</gpg.passphrase>
              <gpg.keyname>C6EED57A</gpg.keyname>
          </properties>
      </profile>
    </profiles>

.....
 <settings>
Note how the id element in the server element in settings.xml is identical to the id elements in the snapshotRepository and repository element as well as the serverId configuration of the Nexus Staging Maven plugin (Server id is taken from our project parent pom file - http://repo2.maven.org/maven2/org/sonatype/oss/oss-parent/9/oss-parent-9.pom ).

Before starting

  • verify that all CI are green, all CI badges should be green - https://github.com/checkstyle/checkstyle
  • Verify that test release works fine on Travis: https://travis-ci.org/checkstyle/checkstyle/builds, search for “release dry run”.
  • Ensure your work space is in sync with Git.
  • Ensure that repository is cloned by ssh protocol.
  • Recheck that copyright is updated to recent year at:

    checkstyle

    contributions

    sevntu-checkstyle

    project (for ALL!!! to avoid build failures after release) :

find . -type f \( -name *.java -o -name *.header \) -exec sed -i  \
  "s/\/\/ Copyright (C) 2001-2015 the original author or authors./\/\/ Copyright (C) 2001-2016 the original author or authors./g" \
  {} +
  • Next version. Review all changes and if where is no new Checks or new options in Checks or any new functionality that might require updated in some Checkstyle plugins and integrations - please bump only 3rd digit of release number:
mvn versions:set -DnewVersion=6.4.1-SNAPSHOT && mvn versions:commit
git add pom.xml && git commit -m "config: update to 6.4.1-SNAPSHOT" && git push
Change milestone number in github - https://github.com/checkstyle/checkstyle/milestones Most likely it is not required to update other repos with new version, as next version will be most likely bump in minor number, … but there could be failures in CIs…. .

Perform release build

ATTENTION: before providing password for SSH , verify that previous version and next versions are what you expect.

TKN=

PREV_RELEASE=$(git describe $(git rev-list --tags --max-count=1) | sed "s/checkstyle-//")
curl -i -H "Authorization: token $TKN" \
  -d "{ \"tag_name\": \"checkstyle-$PREV_RELEASE\", \
        \"target_commitish\": \"master\", \
        \"name\": \"\", \
        \"body\": \"http://checkstyle.sourceforge.net/releasenotes.html#Release_$PREV_RELEASE\", \
        \"draft\": false,   \"prerelease\": false }" \
  -X POST https://api.github.com/repos/checkstyle/checkstyle/releases

RELEASE_ID=$(curl -s -X GET https://api.github.com/repos/checkstyle/checkstyle/releases/tags/checkstyle-$PREV_RELEASE | jq ".id")
curl -i -H "Authorization: token $TKN" \
  -H "Content-Type: application/zip" \
  --data-binary @"target/checkout/target/checkstyle-$PREV_RELEASE-all.jar" \
  -X POST https://uploads.github.com/repos/checkstyle/checkstyle/releases/$RELEASE_ID/assets?name=checkstyle-$PREV_RELEASE-all.jar
Recheck release notes: https://github.com/checkstyle/checkstyle/releases/ .

Attention: if process is hanging on stage of version bump (scm plugin):

#stop the process (cntrl+c)
mvn release:rollback
git tag -d checkstyle-7.2
git push origin :refs/tags/checkstyle-7.2
./release.sh
Nuance - there will be some to-and-from commits in git history.

If you lost a moment when password was required to upload by `scp` to hosting, you can repeat by

mvn -e -Pgpg release:perform -Darguments='-Dcheckstyle.ant.skip=true -Dcheckstyle.skip=true -DskipNexusStagingDeployMojo=true'
and all further commands from release script should be done manually.

ATTENTION: Verify that the artifacts are automatically synchronized to the Maven Central Repository, Maven Search Engine. (beware that artifact appearance on maven central could take from 10 min to 2 hours) Syncing to Maven Central could take some time.

ATTENTION: do not proceed further till artifact appear in Maven Central Repository.

curl http://repo1.maven.org/maven2/com/puppycrawl/tools/checkstyle/
curl "http://search.maven.org/solrsearch/select/?q=com.puppycrawl.tools&a=checkstyle&wt=json"
one command to notify(in ubuntu) when version is accessible on maven central:
VERSION=$(git describe $(git rev-list --tags --max-count=1) | sed "s/checkstyle-//") && while [[ $(curl -s -o /dev/null -I -w "%{http_code}" http://repo1.maven.org/maven2/com/puppycrawl/tools/checkstyle/$VERSION/) != 200 ]]; do sleep 60; done; notify-send "checkstyle $VERSION is accessible"

Update for HTML reports

Update for released version reference

update to new snapshot version:

update to point to new strict version of Checkstyle (WE need to recheck why “RELEASE” as version does not help us):

Final Checks

  • MANDATORY!!: Verify that build statuses are green to fix issues before announcements

https://github.com/sevntu-checkstyle/checkstyle-samples ,

https://github.com/sevntu-checkstyle/sevntu.checkstyle ,

https://github.com/checkstyle/contribution,

https://github.com/checkstyle/checkstyle

Announcements

create issue to release eclipse-cs

Create new issue on eclipse-cs on with title “upgrade to checkstyle 8.X” and description “http://checkstyle.sourceforge.net/releasenotes.html#Release_8.X”

Release checkstyle-sonar-plugin

Create new issue on checkstyle-sonar-plugin on with title “upgrade to checkstyle 8.X” and description “http://checkstyle.sourceforge.net/releasenotes.html#Release_8.X , upgrade version at https://github.com/checkstyle/sonar-checkstyle/edit/master/pom.xml#L88”

Do release https://github.com/checkstyle/sonar-checkstyle/wiki/How-to-make-release