|
3 | 3 | milestone: |
4 | 4 | types: [closed] |
5 | 5 | jobs: |
6 | | - build: |
| 6 | + release: |
7 | 7 | name: Release ${{ github.event.milestone.title }} |
8 | 8 | runs-on: ubuntu-latest |
9 | 9 | steps: |
10 | 10 | - name: Checkout code |
11 | | - uses: actions/checkout@v4 |
| 11 | + uses: actions/checkout@v5 |
12 | 12 | with: |
13 | 13 | ref: master |
14 | 14 | fetch-depth: 0 |
| 15 | + - name: Validate Gradle Wrapper |
| 16 | + uses: gradle/actions/wrapper-validation@v5 |
15 | 17 | - name: Set up Git |
16 | 18 | run: | |
17 | 19 | git config user.name "Zonky Bot" |
18 | 20 | git config user.email "bot@zonky.com" |
19 | | - - name: Set up JDK |
20 | | - uses: actions/setup-java@v4 |
| 21 | + - name: Set up JDK 8 |
| 22 | + uses: actions/setup-java@v5 |
21 | 23 | with: |
22 | 24 | distribution: 'zulu' |
23 | | - java-version: 8 |
24 | | - server-id: ossrh |
25 | | - server-username: MAVEN_USER |
26 | | - server-password: MAVEN_PASS |
27 | | - gpg-private-key: ${{ secrets.SIGNING_CERT }} |
28 | | - gpg-passphrase: SIGNING_PASS |
29 | | - - name: Release with Maven |
| 25 | + java-version: '8' |
| 26 | + cache: 'gradle' |
| 27 | + - name: Make Gradle wrapper executable |
| 28 | + run: chmod +x gradlew |
| 29 | + - name: Publish to Maven Central via Gradle |
30 | 30 | env: |
31 | 31 | RELEASE_VERSION: ${{ github.event.milestone.title }} |
32 | | - MAVEN_USER: ${{ secrets.MAVEN_USER }} |
33 | | - MAVEN_PASS: ${{ secrets.MAVEN_PASS }} |
34 | | - SIGNING_PASS: ${{ secrets.SIGNING_PASS }} |
35 | | - run: mvn -B release:prepare release:perform -DreleaseVersion=$RELEASE_VERSION |
36 | | - - name: Upload staged artifacts to Central Sonatype |
| 32 | + # Gradle signing plugin (build.gradle.kts) |
| 33 | + MAVEN_SIGNING_KEY: ${{ secrets.SIGNING_CERT }} |
| 34 | + MAVEN_SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASS }} |
| 35 | + # nmcp credentials (build.gradle.kts) |
| 36 | + USERNAME_TOKEN: ${{ secrets.MAVEN_USER }} |
| 37 | + PASSWORD_TOKEN: ${{ secrets.MAVEN_PASS }} |
| 38 | + # Use the milestone title as the build's version without touching gradle.properties |
| 39 | + run: | |
| 40 | + ./gradlew \ |
| 41 | + -Pversion=$RELEASE_VERSION \ |
| 42 | + clean check publishAllPublicationsToCentralPortal \ |
| 43 | + --stacktrace |
| 44 | + # Reproduces Maven Release Plugin’s v@{project.version} tag |
| 45 | + - name: Tag release |
| 46 | + if: success() |
37 | 47 | env: |
38 | | - SONATYPE_USERNAME: ${{ secrets.MAVEN_USER }} |
39 | | - SONATYPE_PASSWORD: ${{ secrets.MAVEN_PASS }} |
| 48 | + RELEASE_VERSION: ${{ github.event.milestone.title }} |
40 | 49 | run: | |
41 | | - SONATYPE_TOKEN=$(printf "$SONATYPE_USERNAME:$SONATYPE_PASSWORD" | base64) |
42 | | - PUBLISH_NAMESPACE="io.zonky" |
43 | | - echo "Uploading artifacts from OSSRH-Staging to Central Sonatype..." |
44 | | - RESPONSE=$(curl -s -w "%{http_code}" -o response_body.txt -X POST \ |
45 | | - -H "Authorization: Bearer $SONATYPE_TOKEN" \ |
46 | | - "https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/$PUBLISH_NAMESPACE?publishing_type=user_managed") |
47 | | - if [ "$RESPONSE" -ne 200 ]; then |
48 | | - echo "Failed to upload artifacts to Central Sonatype. Response code: $RESPONSE. Response body: " |
49 | | - cat response_body.txt |
50 | | - echo "Visit https://central.sonatype.com/publishing/deployments for more information." |
51 | | - exit 1 |
52 | | - else |
53 | | - echo "Artifacts were uploaded successfully to Central Sonatype." |
54 | | - echo "Visit https://central.sonatype.com/publishing/deployments to view your artifacts." |
55 | | - fi |
| 50 | + git tag "v$RELEASE_VERSION" |
| 51 | + git push origin "v$RELEASE_VERSION" |
0 commit comments