Deploy to Maven Central #19
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: Deploy to Maven Central | |
| on: | |
| release: | |
| types: [ released, prereleased ] | |
| workflow_dispatch: | |
| workflow_call: | |
| secrets: | |
| MAVEN_GPG_KEY_CONTENTS: | |
| required: true | |
| MAVEN_SIGNING_PASSWORD: | |
| required: true | |
| MAVEN_CENTRAL_USERNAME: | |
| required: true | |
| MAVEN_CENTRAL_PASSWORD: | |
| required: true | |
| MAVEN_SIGNING_KEY_ID: | |
| required: true | |
| jobs: | |
| publish: | |
| name: Release build and publish | |
| runs-on: macOS-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| env: | |
| ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | |
| ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.MAVEN_SIGNING_KEY_ID }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.MAVEN_SIGNING_PASSWORD }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.MAVEN_GPG_KEY_CONTENTS }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Restore Cache | |
| uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/configuration-cache | |
| ~/.gradle/wrapper | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@94baf225fe0a508e581a564467443d0e2379123b # v4.3.0 | |
| - name: Setup JDK 17 | |
| uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Import GPG key | |
| uses: crazy-max/ghaction-import-gpg@cb9bde2e2525e640591a934b1fd28eef1dcaf5e5 # 6.2.4 | |
| with: | |
| gpg_private_key: ${{ secrets.MAVEN_GPG_KEY_CONTENTS }} | |
| passphrase: ${{ secrets.MAVEN_SIGNING_PASSWORD }} | |
| - name: Publish library to Maven Central | |
| run: ./gradlew :puree:publishAndReleaseToMavenCentral --no-configuration-cache |