Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mathieusoysal/java-maven-library-publisher
GitHub Actions for deploy automatically your java maven library to GitHub Packages and Maven Central.
https://github.com/mathieusoysal/java-maven-library-publisher
java library maven sonatype
Last synced: 3 months ago
JSON representation
GitHub Actions for deploy automatically your java maven library to GitHub Packages and Maven Central.
- Host: GitHub
- URL: https://github.com/mathieusoysal/java-maven-library-publisher
- Owner: MathieuSoysal
- License: apache-2.0
- Created: 2022-02-10T18:12:23.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-04-03T14:07:12.000Z (almost 2 years ago)
- Last Synced: 2024-10-09T13:16:23.595Z (4 months ago)
- Topics: java, library, maven, sonatype
- Language: Java
- Homepage:
- Size: 39.1 KB
- Stars: 4
- Watchers: 2
- Forks: 3
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
- Your project need to use Maven
- [ ] [Create an account on Sonatype](https://issues.sonatype.org/secure/Signup!default.jspa)
- [ ] [Create a JIRA ticket on Sonatype to approve your groupId (io.github.YOUR-GITHUB-USERNAME)](https://issues.sonatype.org/secure/CreateIssue.jspa?issuetype=21&pid=10134)
- [ ] [Generate a gpg key and distribute the public key to a keyserver](https://central.sonatype.org/publish/requirements/gpg/)## 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 > privkey.asc`
- [ ] **GPG_PASSPHRASE** with the passphrase of your gpg key### pom.xml
Inside your *pom.xml* file you need to set:
- [ ] [**the good *groupId*** (io.github.YOUR-GITHUB-USERNAME)](https://github.com/MathieuSoysal/Java-maven-libray-publisher/blob/605c3ac3f7da571b4d63009a89b0cf22710d1603/pom-example.xml#L6)
- [ ] [**a description**](https://github.com/MathieuSoysal/Java-maven-libray-publisher/blob/605c3ac3f7da571b4d63009a89b0cf22710d1603/pom-example.xml#L16)
- [ ] [**a license**](https://github.com/MathieuSoysal/Java-maven-libray-publisher/blob/605c3ac3f7da571b4d63009a89b0cf22710d1603/pom-example.xml#L68-L75)
- [ ] [**the developers**](https://github.com/MathieuSoysal/Java-maven-libray-publisher/blob/605c3ac3f7da571b4d63009a89b0cf22710d1603/pom-example.xml#L77-L90)
- [ ] [**issueManagement**](https://github.com/MathieuSoysal/Java-maven-libray-publisher/blob/605c3ac3f7da571b4d63009a89b0cf22710d1603/pom-example.xml#L92-L96)
- [ ] [**scm**](https://github.com/MathieuSoysal/Java-maven-libray-publisher/blob/605c3ac3f7da571b4d63009a89b0cf22710d1603/pom-example.xml#L98-L105)
- [ ] [**the ossrhDeploy profile**](https://github.com/MathieuSoysal/Java-maven-libray-publisher/blob/605c3ac3f7da571b4d63009a89b0cf22710d1603/pom-example.xml#L109-L192)
- [ ] [**the githubDeploy profile**](https://github.com/MathieuSoysal/Java-maven-libray-publisher/blob/605c3ac3f7da571b4d63009a89b0cf22710d1603/pom-example.xml#L195-L206)*For more details you can look [pom-example.xml](https://github.com/MathieuSoysal/Java-maven-libray-publisher/blob/main/pom-example.xml)*
## Usage
The workflow, usually declared in `.github/workflows/library-publish.yml`, looks like:
```YAML
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](https://user-images.githubusercontent.com/43273304/153753204-fbf0d020-c650-4b9f-9b55-13a53f50bc5b.png)Don't forget to add your own MavenCentral badges to your readme :wink::
- to get your maven-central badge : https://shields.io/category/platform-support## License
The Dockerfile and associated scripts and documentation in this project are released under the [Apache 2.0 License](https://github.com/MathieuSoysal/Javadoc-publisher.yml/blob/main/LICENSE).