diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
new file mode 100644
index 0000000..fa6ca31
--- /dev/null
+++ b/.github/workflows/release.yaml
@@ -0,0 +1,53 @@
+# 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@v4
+ with:
+ fetch-depth: 0
+ - name: Java setup
+ uses: actions/setup-java@v3
+ with:
+ java-version: '8'
+ distribution: 'temurin'
+ cache: maven
+ - name: Run a build of the code base before release
+ run: ./mvnw --batch-mode --no-transfer-progress clean install
+ - name: Set release version
+ run: ./mvnw --batch-mode --no-transfer-progress versions:set -DnewVersion=${{ github.event.inputs.version }}
+ - name: Commit & Push changes
+ uses: actions-js/push@v1.4
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ message: "Releasing version ${{ github.event.inputs.version }}"
+ - name: Release with JReleaser
+ env:
+ JRELEASER_TAG_NAME: ${{ github.event.inputs.version }}
+ JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }}
+ JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
+ JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
+ JRELEASER_NEXUS2_USERNAME: ${{ secrets.JRELEASER_NEXUS2_USERNAME }}
+ JRELEASER_NEXUS2_PASSWORD: ${{ secrets.JRELEASER_NEXUS2_PASSWORD }}
+ JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: ./release.sh
+ - name: Set the next release version
+ run: ./mvnw --batch-mode --no-transfer-progress versions:set -DnewVersion=${{ github.event.inputs.nextVersion }}-SNAPSHOT
+ - name: Commit & Push changes
+ uses: actions-js/push@v1.4
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ message: "Setting version ${{ github.event.inputs.nextVersion }}-SNAPSHOT"
diff --git a/pom.xml b/pom.xml
index b45af2a..4fd78b7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,6 +7,40 @@
runtimes-agent
1.0.0-SNAPSHOT
+ Red Hat Insights Java Agent
+ Red Hat Insights Java Agent
+ https://github.com/RedHatInsights/insights-java-agent
+ 2023
+
+
+
+ The Apache License, Version 2.0
+ http://www.apache.org/licenses/LICENSE-2.0.txt
+
+
+
+
+
+ Benjamin Evans
+ beevans@redhat.com
+ Red Hat
+ https://www.redhat.com/
+
+
+ ebaron
+ Elliott Baron
+ ebaron@redhat.com
+ Red Hat
+ https://www.redhat.com/
+
+
+
+
+ scm:git:git://github.com/RedHatInsights/insights-java-agent.git
+ scm:git:ssh://github.com:RedHatInsights/insights-java-agent.git
+ http://github.com/RedHatInsights/insights-java-agent/tree/main
+
+
8
@@ -39,6 +73,9 @@
3.1.0
3.2.0
3.3.0
+ 3.3.0
+ 3.6.2
+ 1.9.0
com.redhat.insights.agent.shaded
@@ -440,6 +477,7 @@
jar-with-dependencies
+ true
@@ -515,5 +553,86 @@
+
+
+ release
+
+
+
+ org.jreleaser
+ jreleaser-maven-plugin
+ ${jreleaser-maven-plugin.version}
+ false
+
+
+
+ ALWAYS
+ true
+
+
+
+
+
+ ALWAYS
+ https://oss.sonatype.org/service/local
+ https://oss.sonatype.org/content/repositories/snapshots/
+ true
+ true
+ target/staging-deploy
+
+
+
+
+
+
+
+
+
+
+
+
+ publication
+
+ local::file:./target/staging-deploy
+
+
+ deploy
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ ${maven-javadoc-plugin.version}
+
+
+ attach-javadocs
+
+ jar
+
+
+ true
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ ${maven-source-plugin.version}
+
+
+ attach-sources
+
+ jar-no-fork
+
+
+ true
+
+
+
+
+
+
+
+
diff --git a/release.sh b/release.sh
new file mode 100755
index 0000000..dfe4caf
--- /dev/null
+++ b/release.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+set -euo pipefail
+IFS=$'\n\t'
+
+echo "📦 Staging artifacts..."
+./mvnw --batch-mode --no-transfer-progress -Ppublication -DskipTests=true -Dskip.spotless=true
+
+echo "🚀 Releasing..."
+./mvnw --batch-mode --no-transfer-progress -Prelease jreleaser:full-release
+
+echo "🎉 Done!"