GitHub action to build a Java Maven library and publish it to GitHub Packages and Maven Central.
Create your GitHub secrets on your repository:
gpg --armor --export-secret-key <key-id> > privkey.asc
Inside your pom.xml file you need to set:
For more details you can look pom-example.xml
The workflow, usually declared in .github/workflows/library-publish.yml
, looks like:
name: Java library publisher
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Maven Library build and publish
uses: MathieuSoysal/Java-maven-library-publisher@v1.0.3
with:
nexus-username: $
nexus-password: $
gpg-private-key: $
gpg-passphrase: $
github-token: $
java-version: 17
Don’t forget to add your own MavenCentral badges to your readme :wink::
The Dockerfile and associated scripts and documentation in this project are released under the Apache 2.0 License.