|
| 1 | +name: Release using JReleaser |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + version: |
| 7 | + description: 'Release version' |
| 8 | + required: true |
| 9 | + nextVersion: |
| 10 | + description: 'Next version after release (-SNAPSHOT will be added automatically)' |
| 11 | + required: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + release: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - name: Checkout |
| 18 | + uses: actions/checkout@v3 |
| 19 | + with: |
| 20 | + fetch-depth: 0 |
| 21 | + |
| 22 | + - name: Setup Java |
| 23 | + uses: actions/setup-java@v4 |
| 24 | + with: |
| 25 | + distribution: temurin |
| 26 | + java-version: 21 |
| 27 | + cache: gradle |
| 28 | + |
| 29 | + - name: Setup Gradle |
| 30 | + uses: gradle/actions/setup-gradle@v4 |
| 31 | + |
| 32 | + - name: JReleaser full release |
| 33 | + env: |
| 34 | + JRELEASER_PROJECT_VERSION: ${{ github.event.inputs.version }} |
| 35 | + JRELEASER_GITHUB_TOKEN: ${{ secrets.JRELEASER_GITHUB_TOKEN }} |
| 36 | + JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.JRELEASER_MAVENCENTRAL_USERNAME }} |
| 37 | + JRELEASER_MAVENCENTRAL_TOKEN: ${{ secrets.JRELEASER_MAVENCENTRAL_TOKEN }} |
| 38 | + JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }} |
| 39 | + JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }} |
| 40 | + JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }} |
| 41 | + run: ./gradlew --console=plain --no-daemon --stacktrace jreleaserFullRelease -Pversion=${{ github.event.inputs.version }} |
| 42 | + |
| 43 | + - name: JReleaser release output |
| 44 | + if: always() |
| 45 | + uses: actions/upload-artifact@v4 |
| 46 | + with: |
| 47 | + name: jreleaser-release |
| 48 | + path: | |
| 49 | + out/jreleaser/trace.log |
| 50 | + out/jreleaser/output.properties |
| 51 | +
|
| 52 | + - name: Update version in properties |
| 53 | + run: sed -i 's/^version=.*/version=${{ github.event.inputs.nextVersion }}-SNAPSHOT/g' gradle.properties |
| 54 | + |
| 55 | + - name: Commit & Push version update |
| 56 | + uses: actions-js/push@master |
| 57 | + with: |
| 58 | + github_token: ${{ secrets.JRELEASER_GITHUB_TOKEN }} |
| 59 | + message: "chore: bump version to ${{ github.event.inputs.nextVersion }}-SNAPSHOT" |
| 60 | + tags: true |
0 commit comments