Today I had the task to use GitHub actions to automatically publish an open source Java project to the maven repository. The following post should simply explain all steps.

Register account

Generate GPG keys

Use the following commands to generate a new key pair and output the secret key to a file “private.pgp”

GitHub action

Create at your repository the following repository secrets:

  • OSSRH_USERNAME = The username of your account from sonatype.org
  • OSSRH_PASSWORD = The password of your account from sonatype.org
  • GPG_PRIVATE_KEY = The content of the private.pgp file
  • GPG_PASSPHRASE = The passphrase of your private key

Then you can simply use the following workflow file s.

--

--

Christoph Kappestein

I am a developer in the API space, currently working on Fusio an open source API management platform

Following