|
| 1 | +name: Plugin publish |
| 2 | + |
| 3 | +# This workflow is strictly manual |
| 4 | +# https://docs.github.com/en/actions/using-workflows/manually-running-a-workflow |
| 5 | +on: |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: read |
| 10 | + |
| 11 | +jobs: |
| 12 | + gradle: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + environment: |
| 16 | + # This job must only run in Publishing environment. It is protected from the majority of runs, which prevents Gradle secrets leakage |
| 17 | + name: Publishing |
| 18 | + url: https://github.com/build-extensions-oss/gradle-plugin-utils/settings/environments/10454071555/edit |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Checkout Repo |
| 22 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 23 | + |
| 24 | + # Protect from putting custom jar as a gradle wrapper |
| 25 | + # https://github.com/gradle/actions/tree/main/wrapper-validation |
| 26 | + - name: Validate Gradle wrapper |
| 27 | + uses: gradle/actions/wrapper-validation@v5 |
| 28 | + |
| 29 | + # https://github.com/marketplace/actions/setup-java-jdk |
| 30 | + - name: Set up JDK 17 |
| 31 | + uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0 |
| 32 | + with: |
| 33 | + java-version: 17 |
| 34 | + distribution: 'temurin' |
| 35 | + |
| 36 | + # Optimize Gradle execution |
| 37 | + # https://github.com/marketplace/actions/build-with-gradle |
| 38 | + - name: Setup Gradle |
| 39 | + with: |
| 40 | + # disable cache for publication. We build from scratch here, so let's avoid having a theoretical vulnerability when cache entry was put in a declined PR, however reused by this build |
| 41 | + cache-disabled: true |
| 42 | + uses: gradle/actions/setup-gradle@v5 |
| 43 | + |
| 44 | + # Build and publish the project by simply running the command line |
| 45 | + - name: Publish the project |
| 46 | + run: /gradlew publishToMavenCentral --stacktrace |
| 47 | + env: |
| 48 | + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }} |
| 49 | + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} |
| 50 | + ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }} |
| 51 | + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY_RING_FILE_CONTENT }} |
0 commit comments