added workflow for releasing using jreleaser #1
Workflow file for this run
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 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Generate token | |
id: generate-token | |
uses: actions/create-github-app-token@v1 | |
with: | |
app-id: ${{ secrets.UNLEASH_BOT_APP_ID }} | |
private-key: ${{ secrets.UNLEASH_BOT_PRIVATE_KEY }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 17 | |
with: | |
java-version: "17" | |
distribution: "temurin" | |
cache: maven | |
- name: Set release version | |
run: | | |
mvn --no-transfer-progress --batch-mode versions:set -DnewVersion=${{ github.event.inputs.version }} | |
- name: Commit & Push changes | |
uses: actions-js/push@master | |
with: | |
github_token: ${{ steps.generate-token.outputs.token }} | |
message: Releasing version ${{ github.event.inputs.version }} | |
- name: Stage release | |
run: | | |
mvn --no-transfer-progress --batch-mode -Ppublication clean deploy -DaltDeploymentRepository=local::default::file://`pwd`/target/staging-deploy | |
- name: Run JReleaser | |
uses: jreleaser/release-action@v2 | |
with: | |
setup-java: false | |
env: | |
JRELEASER_PROJECT_VERSION: ${{ github.event.inputs.version }} | |
JRELEASER_GITHUB_TOKEN: ${{ secrets.JRELEASER_GITHUB_TOKEN }} | |
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 }} | |
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.JRELEASER_MAVENCENTRAL_USERNAME }} | |
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.JRELEASER_MAVENCENTRAL_PASSWORD }} | |
- name: Set next version | |
run: | | |
mvn --no-transfer-progress --batch-mode versions:set -DnewVersion=${{ github.event.inputs.nextVersion }} | |
- name: Commit & Push changes | |
uses: actions-js/push@master | |
with: | |
github_token: ${{ steps.generate-token.outputs.token }} | |
message: Setting SNAPSHOT version ${{ github.event.inputs.nextVersion }}-SNAPSHOT | |
tags: true | |
- name: JReleaser release output | |
if: always() | |
uses: actions/upload-artifact@ | |
with: | |
name: jreleaser-release | |
path: | | |
out/jreleaser/trace.log | |
out/jrelaser/output.properties |