Skip to content

Commit

Permalink
Merge pull request #56 from RedHatInsights/ci/release-workflow
Browse files Browse the repository at this point in the history
JReleaser-based release workflow
  • Loading branch information
jponge authored Mar 30, 2023
2 parents ad58cd6 + 02b3fe0 commit c8c44df
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Inspired from https://foojay.io/today/how-to-release-a-java-module-with-jreleaser-to-maven-central-with-github-actions/
name: Publish a new release

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: Git checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Java setup
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: maven
- name: Set release version
run: mvn --batch-mode versions:set -DnewVersion=${{ github.event.inputs.version }}
- name: Commit & Push changes
uses: actions-js/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
message: Releasing version ${{ github.event.inputs.version }}
- name: Release with JReleaser
uses: jreleaser/release-action@v2
with:
setup-java: false
env:
JRELEASER_PROJECT_VERSION: ${{ github.event.inputs.version }}
JRELEASER_TAG_NAME: ${{ github.event.inputs.version }}

This comment has been minimized.

Copy link
@aalmiray

aalmiray Apr 3, 2023

This could be replaced in jreleaser.yml by adding tagName: '{{projectVersion}}' inside the release.github` section 😏

JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set the next release version
run: mvn --batch-mode versions:set -DnewVersion=${{ github.event.inputs.nextVersion }}
- name: Commit & Push changes
uses: actions-js/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
message: Setting SNAPSHOT version ${{ github.event.inputs.nextVersion }}-SNAPSHOT
tags: true
26 changes: 26 additions & 0 deletions jreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
project:
name: insights-java-client
version: 999 # To be overriden by the environment variable JRELEASER_PROJECT_VERSION
description: Red Hat Insights Java Client
longDescription: Red Hat Insights Java Client
authors:
- Red Hat
license: Apache-2.0
links:
homepage: https://github.com/RedHatInsights/insights-java-client
java:
groupId: com.redhat.insight
version: 11

release:
github:
owner: RedHatInsights
changelog:
links: true
formatted: ALWAYS
hide:
contributors:
- "GitHub"
- "dependabot[bot]"
- "[bot]"

0 comments on commit c8c44df

Please sign in to comment.