Publish package to GitHub Packages and Maven Central #47
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish package to GitHub Packages and Maven Central | |
| on: | |
| release: | |
| types: [ created ] | |
| workflow_dispatch: | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Required for git-version plugin | |
| - uses: actions/setup-java@v4 | |
| with: | |
| java-version: '11' | |
| distribution: 'corretto' | |
| - name: Validate Gradle wrapper | |
| uses: gradle/wrapper-validation-action@v2 | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v3 | |
| - name: Verify Javadoc generation | |
| run: ./gradlew javadoc | |
| - name: Check Javadoc generation | |
| run: | | |
| if [ -d "build/docs/javadoc" ]; then | |
| echo "Javadoc verified successfully" | |
| else | |
| echo "ERROR: Javadoc directory not found" | |
| exit 1 | |
| fi | |
| - name: Publish to GitHub Packages | |
| # GitHub Packages doesn't require GPG signing (unlike Maven Central). | |
| # The -PskipSigning flag disables the vanniktech plugin's signAllPublications() | |
| # which would otherwise fail without GPG credentials. | |
| run: ./gradlew publish -PskipSigning | |
| env: | |
| GITHUB_ACTOR: ${{ github.actor }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish to Maven Central | |
| run: ./gradlew publishAndReleaseToMavenCentral | |
| env: | |
| # Nexus tokens were generated before we migrated to the new Maven Central, | |
| # it's backward compatible. | |
| ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.NEXUS_TOKEN_USERNAME }} | |
| ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.NEXUS_TOKEN_PASSWORD }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_SIGNING_KEY }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_SIGNING_PASSPHRASE }} |