Performing a Release - robolectric/robolectric GitHub Wiki
Preparation
-
In order to sign release artifacts, you will need to have access to the Robolectric GPG key. Ask a Robolectric maintainer for the Robolectric key. Once you have it, run:
gpg --import robolectric.asc
This will prompt you for the key password (ask an existing Robolectric maintainer what this is).
-
Gradle artifact signing requires the legacy
secring.gpg
file, which is not generated any more when running v2.1+ of GnuPG. If you have not already done this, you will need to export it using:gpg --keyring secring.gpg --export-secret-keys > ~/.gnupg/secring.gpg
This will prompt you for your user password.
-
Once you have imported the gpg signing keys, ensure that you have signing and release credentials in your
~/.gradle/gradle.properties
. You can ask a Robolectric maintainer what the password and sonatype login is.signing.keyId=B408DBD5 signing.password=******** signing.secretKeyRingFile=/home/_____/.gnupg/secring.gpg systemProp.sonatype-login=******** systemProp.sonatype-password=********
-
You may want to check if the
google
branch is ahead of themaster
branch and if there are any commits you would like to include in the release. Releases are performed from themaster
branch.
Release
[!IMPORTANT] None of these instructions require a force-push. If you find yourself needing a force push, something went wrong, and you should reset and start over.
[!IMPORTANT] Never release anything (to either MavenCentral or the
git push
commands) until the release has been validated using the MavenCentral staging repository.
-
Ensure that you are on the latest master branch of the GitHub repository.
git fetch origin git checkout master git pull
If there are errors, it usually means you have extra commits in the
master
branch, and you should either save those commits in a new branch, or dogit checkout master && git reset --hard origin/master
. -
Ensure that a release branch has been created. For instance, for 4.2.x releases, ensure that the branch exists:
git checkout -b robolectric-4.2.x
-
If the release branch already exists, ensure that it updated to the latest version
git checkout robolectric-4.2.x git pull
If there are errors, it usually means you have extra commits in the release branch, and you should either save those commits in a new branch, or do e.g.
git checkout robolectric-4.2.x && git reset --hard origin/robolectric-4.2.x
. -
Update the version number. Edit
gradle.properties
to remove-SNAPSHOT
. Version strings look like4.2
or4.2-beta-1
. -
Commit and tag the changes:
versionNumber=___ git commit -m "Bump version to $versionNumber."
-
Assemble all of the release artifacts:
/gradlew clean assemble
-
Run tests in your local workstation:
./gradlew test --parallel -Dorg.gradle.workers.max=4 -Drobolectric.alwaysIncludeVariantMarkersInTestName=true
-
Upload the artifacts
./gradlew publish
-
Log into Sonatype and close the staging repository.
-
Use the staging repository URL to test the uploaded artifacts. Add this to your sample app's
repositories
section.maven { url "https://oss.sonatype.org/content/repositories/orgrobolectric-____" }
-
Go to a sample Android app that contains a Robolectric test. Update the test dependencies to the new (staged) version. Validate that the release has the expected functionality. For instance, if the release supports a new SDK level, ensure that a test can run on that new SDK level.
[!IMPORTANT] It is also important to verify that native functionality (e.g. SQLite and graphics) work on both Linux x86_64 and Mac M1.
-
If everything has worked so far, it's time to actually release the artifacts!
-
Push the commits to the release branch
git push origin robolectric-4.2.x
[!IMPORTANT] If you encounter an error here, it means your release branch is outdated or contains extra commits. Reset and start over.
-
Tag the new version and push the tag
git tag -a -m "Version $versionNumber" robolectric-$versionNumber git push origin robolectric-$versionNumber
-
Release the staging artifacts to MavenCentral.
-
-
Wait for the new version to appear at Maven Central.
-
Publish the GitHub release notes. Update the mailing list and Twitter account.
-
Switch to the
master
branch. Ensure that the version number is bumped and contains the-SNAPSHOT
suffix. -
If it is not, commit the new development version number:
git commit -m "Bump version to <next version number>-SNAPSHOT."
-
Bump docs and related projects to point at the latest version:
Update docs
-
Assemble and aggregate Javadocs:
./gradlew clean aggregateDocs
-
Add updated javadoc and jsondoc to the
robolectric.github.io
repository:docRepo=../robolectric.github.io docVersion=__ mv build/docs/javadoc $docRepo/docs/javadoc/$docVersion
-
Update
robolectric.github.io
'smkdocs.yml
to add new version to the sidebar, and update latest version information. SearchJavadoc
to find the place to modify. -
ln -sfn $docVersion docs/javadoc/latest