Skip to content

GitHub Actions for deploy automatically your java maven library to GitHub Packages and Maven Central.

License

Notifications You must be signed in to change notification settings

MathieuSoysal/Java-maven-library-publisher

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build and publish automatically your Java Maven Library to GitHub Packages and Maven Central.

GitHub action to build a Java Maven library and publish it to GitHub Packages and Maven Central.

Requirements

Configurations

GitHub secrets

Create your GitHub secrets on your repository:

  • NEXUS_USERNAME with your username used on Sonatype
  • NEXUS_PASSWORD with your password used on Sonatype
  • GPG_PRIVATE_KEY with the private key of your generated pgp key
    • to get the private key gpg --armor --export-secret-key <key-id> > privkey.asc
  • GPG_PASSPHRASE with the passphrase of your gpg key

pom.xml

Inside your pom.xml file you need to set:

For more details you can look pom-example.xml

Usage

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/[email protected]
        with:
          nexus-username: ${{ secrets.NEXUS_USERNAME }}
          nexus-password: ${{ secrets.NEXUS_PASSWORD }}
          gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
          gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
          github-token: ${{ secrets.GITHUB_TOKEN }}
          java-version: 17

Badge

image

Don't forget to add your own MavenCentral badges to your readme 😉:

License

The Dockerfile and associated scripts and documentation in this project are released under the Apache 2.0 License.

About

GitHub Actions for deploy automatically your java maven library to GitHub Packages and Maven Central.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •  

Languages