Release using JReleaser #20
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: Release using JReleaser | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Release version' | |
| required: true | |
| nextVersion: | |
| description: 'Next version after release (-SNAPSHOT will be added automatically)' | |
| required: true | |
| env: | |
| GRADLE_OPTS: "-Dorg.gradle.console=plain -Dorg.gradle.daemon=false -Dorg.gradle.stacktrace=always" | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.JRELEASER_GITHUB_TOKEN }} | |
| fetch-depth: 0 | |
| - name: Check Maven Central availability | |
| run: | | |
| COMPONENTS_JSON=$(curl -sf https://status.maven.org/api/v2/components.json) | |
| check_component() { | |
| local name="$1" | |
| local component_status | |
| component_status=$(echo "$COMPONENTS_JSON" | jq -r --arg name "$name" '.components[] | select(.name == $name) | .status') | |
| if [ "$component_status" != "operational" ]; then | |
| echo "::error::Maven Central component '$name' is $component_status" | |
| return 1 | |
| fi | |
| echo " $name: $component_status" | |
| } | |
| echo "Maven Central status:" | |
| check_component "Portal - central.sonatype.com" | |
| check_component "Cloudflare CDN/Cache" | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| cache: gradle | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Gradle build and publish to local | |
| run: ./gradlew publish -Pversion=${{ github.event.inputs.version }} | |
| - name: Read JReleaser version from .sdkmanrc | |
| id: jreleaser-version | |
| run: echo "version=$(grep '^jreleaser=' .sdkmanrc | cut -d= -f2)" >> "$GITHUB_OUTPUT" | |
| - name: JReleaser full-release | |
| uses: jreleaser/release-action@v2 | |
| with: | |
| version: ${{ steps.jreleaser-version.outputs.version }} | |
| setup-java: false | |
| env: | |
| JRELEASER_STRICT: "true" | |
| JRELEASER_OUTPUT_DIRECTORY: "build/" | |
| JRELEASER_PROJECT_VERSION: ${{ github.event.inputs.version }} | |
| JRELEASER_GITHUB_TOKEN: ${{ secrets.JRELEASER_GITHUB_TOKEN }} | |
| JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.JRELEASER_MAVENCENTRAL_USERNAME }} | |
| JRELEASER_MAVENCENTRAL_TOKEN: ${{ secrets.JRELEASER_MAVENCENTRAL_TOKEN }} | |
| JRELEASER_GPG_KEYNAME: ${{ secrets.JRELEASER_GPG_KEYNAME }} | |
| JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }} | |
| JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }} | |
| JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }} | |
| - name: JReleaser upload output | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: jreleaser-release | |
| path: | | |
| build/jreleaser/trace.log | |
| build/jreleaser/output.properties | |
| - name: Update version in properties | |
| run: sed -i 's/^version=.*/version=${{ github.event.inputs.nextVersion }}-SNAPSHOT/g' gradle.properties | |
| - name: Commit & Push version update | |
| uses: actions-js/push@master | |
| with: | |
| github_token: ${{ secrets.JRELEASER_GITHUB_TOKEN }} | |
| message: "chore: bump version to ${{ github.event.inputs.nextVersion }}-SNAPSHOT" | |
| author_email: 'bot@framefork.org' | |
| author_name: 'Framefork BOT' | |
| branch: master | |
| tags: false |