Publish package to MavenCentral #21
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 MavenCentral | |
| on: | |
| release: | |
| types: [ created ] | |
| workflow_dispatch: | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| - name: Set version | |
| id: version | |
| run: | | |
| DATE=$(date +'%Y%m%d') | |
| HASH=$(git rev-parse --short HEAD) | |
| echo "VERSION=${DATE}-${HASH}" >> $GITHUB_ENV | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| # https://vanniktech.github.io/gradle-maven-publish-plugin/central | |
| - name: Publish package | |
| run: ./gradlew publishToMavenCentral -Pversion=$VERSION --no-configuration-cache | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }} | |
| ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_SIGNING_KEY_ASC }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_SIGNING_KEY_PASSPHRASE }} | |