Skip to content
Martin Harris edited this page Feb 3, 2021 · 18 revisions

note: instructions are based on https://brooklyn.incubator.apache.org/v/0.7.0-M1/dev/tips/release.html

winrm4j is published to two locations:

  • Sonatype, for snapshots and for staging releases
  • Maven Central, for full (GA and milestone) releases

winrm4j artifacts are generally downloaded from:

  1. Maven Central,
  2. Sonatype,
  3. GitHub.

To publish:

  • a snapshot release:
    • mvn deploy to Sonatype
  • a (milestone) release:
    • same as above, but with some git versioning
    • deploy to Sonatype, then release to Maven Central
  • a GA release:
    • same as above, and
    • bump the snapshot version in brooklyn master to the next release

Configuration

Your .m2/settings.xml must be configured with the right credentials for Sonatype

    <servers>
    ...
            <server>
                    <username> ... </username>
                    <password> ... </password>
                    <id>sonatype-nexus-snapshots</id>
            </server>
            <server>
                    <username> ... </username>
                    <password> ... </password>
                    <id>sonatype-nexus-staging</id>
            </server>
    ...
    </servers>

You must be configured to sign artifacts using GPG.

If this is the first time you have used Sonatype, you will need to create an account and request access.

  1. Create a new account at Sonatype
  2. Raise a new ticket on the Sonatype Jira requesting access. See here for an example. You will need to get an existing project member (e.g. Alex Heneveld, Aled Sage, Martin Harris, or Duncan Grant) to approve the request

The Sonatype - Maven Usage Guide covers this in more details, but is geared towards new projects, not access to existing ones

Releasing

The code snippets below use the following variables:

export WINRM4J_DIR=/path/to/winrm4j
export SNAPSHOT_VERSION=0.1.0-SNAPSHOT
export RELEASE_VERSION=0.1.0
export MAINTENANCE_BRANCH_NAME=0.1.x
export NEXT_MAINTENANCE_BRANCH_SNAPSHOT_VERSION=0.1.1-SNAPSHOT
export NEXT_MASTER_SNAPSHOT_VERSION=0.2.0-SNAPSHOT
export VERSION_MARKER=WINRM4J

export GPG_TTY=$(tty)

It assumes that git is configured with upstream, and that direct access to winrm4j is permitted:

git remote add upstream https://github.com/cloudsoft/winrm4j.git

Deploy Snapshot to Sonatype

Follow these steps when the $WINRM4J_DIR/pom.xml's version has suffix -SNAPSHOT.

Execute the following:

mvn -Dgpg.passphrase="<your passphrase>" -DdeployTo=sonatype -DskipTests -PRelease clean install deploy

Deploy (Milestone) Release

Create a Maintenance Branch

Create a branch for maintenance releases (e.g. 0.1.x):

cd $WINRM4J_DIR
git checkout master
git checkout -b $MAINTENANCE_BRANCH_NAME
git push -u upstream $MAINTENANCE_BRANCH_NAME

Prepare a Release Branch

As the version number exists in multiple places, to change the version number you should use the Apache Brooklyn change-version.sh script

cd $WINRM4J_DIR
git checkout $MAINTENANCE_BRANCH_NAME
git checkout -b $RELEASE_VERSION
/path/to/change-version.sh $VERSION_MARKER $SNAPSHOT_VERSION $RELEASE_VERSION
git status && git diff # Check that this is sensible
git commit -a -m "Changed version to $RELEASE_VERSION"
git push -u upstream $RELEASE_VERSION

Deploy to Sonatype, and Close the repo.

mvn -Dgpg.passphrase="<your passphrase>" -DdeployTo=sonatype -DskipTests -PRelease clean install deploy
  • Go to oss.sonatype.org ... #stagingRepositories (again, need credentials)
  • 'Close' the repo
  • To test the closed repo, you'll need to add the staging repo to the pom of the downstream project. This can be useful if there are multiple people testing a downstream project prior to the release of WinRM4j
    • In Sonatype, select the repo, copy the URL from the summary tab, and add something like the following to the project section of your downstream pom.xml. NOTE: This is a temporary staging repo, and should be deleted once WinRM4j is published
<repositories>
  <repository>
    <id>sonatype-temp</id>
    <url>https://oss.sonatype.org/content/repositories/iocloudsoft-1067</url>
  </repository>
<repositories>
  • If you are testing on the machine you used to build WinRM4j, the artifacts will be in your local .m2 repository and should be deleted: rm -rf ~/.m2/repository/io/cloudsoft/windows/*/$RELEASE_VERSION/

Deploy to Maven Central

Bump version numbers

Update snapshot release on maintenance branch:

cd $WINRM4J_DIR
git checkout $MAINTENANCE_BRANCH_NAME
/path/to/change-version.sh $VERSION_MARKER $SNAPSHOT_VERSION $NEXT_MAINTENANCE_BRANCH_SNAPSHOT_VERSION
git commit -a -m "Changed version to $NEXT_MAINTENANCE_BRANCH_SNAPSHOT_VERSION"
git push -u upstream $MAINTENANCE_BRANCH_NAME

Increment the version number in master:

cd $WINRM4J_DIR
git checkout master
/path/to/change-version.sh $VERSION_MARKER $SNAPSHOT_VERSION $NEXT_MASTER_SNAPSHOT_VERSION
git commit -a -m "Changed version to $NEXT_MASTER_SNAPSHOT_VERSION"
git push

Create a tag for the newly created version:

git checkout $RELEASE_VERSION
git tag -a $RELEASE_VERSION -m "Release "$RELEASE_VERSION
git push upstream --tags 

Remember to check out the master branch (or feature branch) before making changes:

git checkout master

Create a release on github:

On the github repo tags page, select the tag for your new release, click on the ellipsis (...) icon and select "Create release". Enter the release details and click "Publish release"