twitter / util

Wonderful reusable code from Twitter
https://twitter.github.io/util
Apache License 2.0
2.69k stars 583 forks source link

Set up sbt-ci-release to publish from GitHub Actions #275

Closed olafurpg closed 4 years ago

olafurpg commented 4 years ago

Problem: currently, the twitter/util release process requires several manual steps.

Solution: This PR updates the sbt build to use the sbt-ci-release plugin (https://github.com/olafurpg/sbt-ci-release/) to publish releases from GitHub Actions.

In order for the CI releases to succeed, you will need to update the secrets in the GitHub settings here https://github.com/twitter/util/settings/secrets following instructions from the readme here https://github.com/olafurpg/sbt-ci-release/

Result: Every merge into the develop and master branches are published as SNAPSHOT releases and every git tag push is published as a stable release to Maven Central.

Caveat: The biggest change in the build is that the version number is now automatically derived from the git tag using sbt-dynver (https://github.com/dwijnand/sbt-dynver). The benefit of deriving the version number from git is that it's possible to trigger a stable release like 20.4.2 by pushing a tag named "v20.4.2". The current naming convention for git tags is "util-$VERSION", which is not supported by sbt-dynver. Stable releases from now on need to use the format "v$VERSION" instead.

When working locally, this change means that the version number of the sbt build dynamically changes based on the current git commit. It's possible to manually set a stable version for an active sbt session with the command set every version := "20.4.4", in case you need that version for manual publishLocal steps.

cc/ @cacoco

CLAassistant commented 4 years ago

CLA assistant check
All committers have signed the CLA.

olafurpg commented 4 years ago

Closing since this PR was only for demonstration purposes.