Skip to content
asturio edited this page Mar 10, 2024 · 31 revisions

How to publish a release of LibrePDF/OpenPDF to Maven Central

Full documentation from OSSRH: https://central.sonatype.org/publish/publish-maven

Prerequisites

To be able to deploy the new artifacts to maven central, you need a JIRA account in Sonatype. And with that you can publish the artifacts on OSSRH (OSS Repository Hosting). As the artifacts need to be PGP signed, you also need a working infrastructure for doing this with PGP/GPG.

First, make sure you have a JIRA account

This step is only needed once.

If you don't already have a Sonatype JIRA login, then register to create a new account. You will use your username and password to sign files and upload them to the OSSRH Repository.

Currently, @tlxtellef, @bengolder and @asturio are the only users authorized to publish new releases. If you'd like to help us publish releases, let us know. This repository wouldn't exist without the generous help of newcomers. New contributors are welcome. :)

Second, create and publish your public PGP/GPG key

This step is only needed once, and every time you create a new GPG key.

  1. install gpg2 and make sure it is on your PATH

  2. If you don't already have a key, create a key with:

    gpg2 --gen-key

    Use your email and full name and a secure passphrase.

  3. Get the ID for your public key.

    gpg2 --list-keys

    Will show you a list of your keys and their IDs. For example, my key ID is 3806A4CD.

  4. Upload your public key to a keyserver. For example:

    gpg2 --keyserver hkp://pool.sks-keyservers.net --send-keys 3806A4CD

    ... where 3806A4CD is the ID of your public key. It will take 5-30 minutes for the key to become available on the server.

  5. Create a local settings file so that the maven gpg plugin can use your key to sign files. For example, make a file at ~/.m2/settings.xml with similar contents to this example and replace the example JIRA login information and gpg passphrase with your JIRA login and gpg passphrase.

Creating a new release

Third, update the version and tag the release

Note that all version number changes should follow Semantic Versioning 2.0.0

<version> represents the version that is to be released.

<next-version> represents the placeholder version until next release.

Update all the pom.xml files to remove -SNAPSHOT from the version. For example, if our current version is 1.0.0-SNAPSHOT then <version> is 1.0.0.

mvn versions:set -DnewVersion=<version>

Edit README.md to reflect this new version change.

Commit your changes, then add a tag with the new version number.

git tag <version>

Push the tag to Github

git push origin --tags

Publish the release

Assuming you have the repository installed and you're able to build it successfully, there are only two more steps.

First, make a staging release

mvn clean deploy -Prelease

If this runs without errors, go to https://oss.sonatype.org/#stagingRepositories to review the staging release (you will need to login with your JIRA account). If everything looks good, you can publish the release with:

mvn nexus-staging:release

Congrats! If you made it through this step, then you've successfully published a release of OpenPDF!

Wrap up: update to the new working version

Finally, update all the pom.xml files once again and increment the version number (with -SNAPSHOT). For example, if <version> is 1.0.0 then <next-version> could be 1.0.1-SNAPSHOT.

mvn versions:set -DnewVersion=<next-version>

If you want, create a change log in the /changelogs/ directory, or let GitHub do this for you (when you create a new release in GitHub).

Publish the new release in github: https://github.com/LibrePDF/OpenPDF/releases

Commit and push these changes and you're done!!