Release using JReleaser #1
This file contains 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: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 21 | |
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: JReleaser full-release | |
uses: jreleaser/release-action@v2 | |
with: | |
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: '[email protected]' | |
author_name: 'Framefork BOT' | |
branch: master | |
tags: false |