Setting up releases to Sonatype & Maven Central
Create a Sonatype account
You need to create an account on Sonatype and you will need to raise a jira ticket on Sonatype’s jira to get approved on the uk.gov.gchq group. This will require an existing user approved for the group to approve you on the ticket.
Setting up a GPG key
You can use the following commands for setting up a GPG2 key for signing.
Setting up the gradle build
The signing and release to Sonatype is done by various gradle plugins.
id "io.github.gradle-nexus.publish-plugin" version "1.0.0"
id "signing"
id "maven-publish"
See the root and event-logging-api gradle build files (in the event-logging repo) for an example of how to set up gradle.
The credentials can be passed to the gradle build using special gradle env vars Project Properties (external). The credentials required are:
ORG_GRADLE_PROJECT_SIGNINGKEY
- The key as produced by thegpg2 --armor
command.ORG_GRADLE_PROJECT_SIGNINGPASSWORD
- The password for the GPG key.ORG_GRADLE_PROJECT_SONATYPEUSERNAME
- The account username on Sonatype.ORG_GRADLE_PROJECT_SONATYPEPASSWORD
- The account password on Sonatype.
Setting up Github Actions
You will need to provide Github with the four secrets listed above by setting them as repository secrets at https://github.com/gchq/ORG_GRADLE_...
bit as the name.
So that the action can create the Github release you will also need to set up an SSH key pair and provide it with the public and private key. To generate the key pair do:
The key pair will be created in ~/.ssh/
.
Create a repo deploy key with the public key, named ‘Actions Deploy Key’ and with write access at https://github.com/