We aim for the main branch of the repository to always be in a releasable state.
Two types of artifacts can be published:
- Snapshot — An unstable release of the library for testing
- Release — A stable release of the library
Control of these modes of release is managed with a Gradle property IS_SNAPSHOT
.
For both snapshot and release publishing, there are two ways to initiate deployment:
- Automatically
- Manually
This document will focus initially on the automated process, with a section at the end on manual process. (The automated process more or less implements the manual process via GitHub Actions.)
All merges to the main branch trigger an automated snapshot deployment.
Note that snapshots do not have a stable API, so clients should not depend on a snapshot. The primary reason this is documented is for testing, e.g. before deploying a new production version of the library we may test against the snapshot first.
Snapshots can be consumed by:
- Adding the snapshot repository settings.gradle.kts:
dependencyResolutionManagement {
repositories {
maven("https://oss.sonatype.org/content/repositories/snapshots") {
// Optional; ensures only explicitly declared dependencies come from this repository
content {
includeGroup("cash.z.ecc.android")
}
}
}
}
-
Changing the dependency version to end with
-SNAPSHOT
-
Rebuilding
./gradlew assemble --refresh-dependencies
Because Gradle caches dependencies and because multiple snapshots can be deployed under the same version number, using --refresh-dependencies
is important to ensure the latest snapshot is pulled.
Production releases can be consumed using the instructions in the README.MD. Note that production releases can include alpha or beta designations.
Automated production releases still require a manual trigger. To do a production release:
- Update the CHANGELOG.MD for any new changes since the last production release.
- Run the release deployment.
- Confirm deployment succeeded by modifying the Secant Android Wallet to consume the new version.
- Create a new Git tag for the new release in this repository.
- Create a new pull request bumping the version to the next version (this ensures that the next merge to the main branch creates a snapshot under the next version number).
See ci.md, which describes the continuous integration workflow for deployment and describes the secrets that would need to be configured in a repository fork.
- Set up environment to compile the library
- Create file
~/.gradle/gradle.properties
- add your sonotype credentials with these properties
ZCASH_MAVEN_PUBLISH_USERNAME
ZCASH_MAVEN_PUBLISH_PASSWORD
- Point it to a passwordless GPG key that has been ASCII armored, then base64 encoded
ZCASH_ASCII_GPG_KEY
- add your sonotype credentials with these properties
- Update the build number and the CHANGELOG. For release builds, suffix the Gradle invocations below with
-PIS_SNAPSHOT=false
. - Build locally
- This will install the files in your local maven repo at
~/.m2/repository/cash/z/ecc/android/
- This will install the files in your local maven repo at
./gradlew publishAllPublicationsToMavenLocalRepository
- Publish via the following command:
- Snapshot:
./gradlew publishAllPublicationsToMavenCentralRepository -PIS_SNAPSHOT=true
- Release
./gradlew publishAllPublicationsToMavenCentralRepository -PIS_SNAPSHOT=false
- Log into the Sonatype portal to complete the process of closing and releasing the repository.
- Snapshot:
Note: Our existing artifacts can be found here and here: https://search.maven.org/artifact/cash.z.ecc.android/kotlin-bip39