diff --git a/.github/workflows/maven-central-release.yml b/.github/workflows/maven-central-release.yml new file mode 100644 index 00000000..e05f5824 --- /dev/null +++ b/.github/workflows/maven-central-release.yml @@ -0,0 +1,54 @@ +# 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: '11' + 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.MAVEN_CENTRAL_GPG_PUBLIC_KEY }} + JRELEASER_GPG_SECRET_KEY: ${{ secrets.MAVEN_CENTRAL_GPG_SECRET_KEY }} + JRELEASER_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE }} + JRELEASER_NEXUS2_USERNAME: ${{ secrets.MAVEN_CENTRAL_NEXUS2_USERNAME }} + JRELEASER_NEXUS2_PASSWORD: ${{ secrets.MAVEN_CENTRAL_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 e3584b9f..6a6086bf 100644 --- a/pom.xml +++ b/pom.xml @@ -3,12 +3,46 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 + +Cryostat Core +Core library for Cryostat +https://github.com/cryostatio/cryostat-core +2019 + io.cryostat cryostat-core + 2.28.0-SNAPSHOT jar -cryostat-core -http://maven.apache.org + + + + The Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + Universal Permissive License Version 1.0 + http://oss.oracle.com/licenses/upl + repo + Copyright (c) 2018, 2023, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. + + + + + + Andrew Azores + aazores@redhat.com + Red Hat + https://www.redhat.com + + + Elliott Baron + ebaron@redhat.com + Red Hat + https://www.redhat.com + + @@ -18,6 +52,12 @@ + + scm:git://github.com/cryostatio/cryostat-core.git + scm:git:ssh://github.com:cryostatio/cryostat-core.git + https://github.com/cryostatio/cryostat-core/tree/main + + UTF-8 11 @@ -45,6 +85,10 @@ 0.8.11 2.43.0 2.0.7 + + 3.3.0 + 3.6.2 + 1.9.0 @@ -274,6 +318,89 @@ + + + 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 + false + + + + + + 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 00000000..dfe4caf6 --- /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!"