Publish to Maven Central #2
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 to Maven Central | |
| # This workflow triggers whenever you publish a new Release on GitHub | |
| on: | |
| release: | |
| types: [published] | |
| # Allows you to trigger the build manually from the GitHub Actions tab for testing | |
| workflow_dispatch: | |
| jobs: | |
| build-and-publish: | |
| name: Build, Sign, and Publish | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: 'gradle' | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Build and Test | |
| run: ./gradlew :core:build | |
| - name: Publish to Maven Central | |
| run: ./gradlew :core:publishAndReleaseToMavenCentral --no-configuration-cache | |
| env: | |
| # Central Portal Credentials (passed directly to Gradle by the Vanniktech plugin) | |
| ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }} | |
| ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }} | |
| # GPG Signing Credentials | |
| ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_SECRET_KEY }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} |