-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(central): add configurations for JReleaser publication to Maven Ce…
…ntral (#335)
- Loading branch information
1 parent
b104081
commit 93291ae
Showing
4 changed files
with
174 additions
and
6 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Inspired from https://foojay.io/today/how-to-release-a-java-module-with-jreleaser-to-maven-central-with-github-actions/ | ||
name: Publish a new Maven Central release | ||
|
||
on: | ||
workflow_dispatch: | ||
# inputs: | ||
# version: | ||
# description: 'Release version' | ||
# 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: 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.SUBMODULE_TOKEN }} | ||
run: ./release.sh |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,40 @@ | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<name>Cryostat Agent</name> | ||
<description>JVM Agent for Cryostat</description> | ||
<url>https://github.com/cryostatio/cryostat-agent</url> | ||
<inceptionYear>2022</inceptionYear> | ||
<packaging>jar</packaging> | ||
|
||
<groupId>io.cryostat</groupId> | ||
<artifactId>cryostat-agent</artifactId> | ||
|
||
<version>0.4.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
<name>cryostat-agent</name> | ||
<url>http://maven.apache.org</url> | ||
|
||
<licenses> | ||
<license> | ||
<name>The Apache License, Version 2.0</name> | ||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> | ||
<distribution>repo</distribution> | ||
</license> | ||
</licenses> | ||
|
||
<developers> | ||
<developer> | ||
<name>Andrew Azores</name> | ||
<email>[email protected]</email> | ||
<organization>Red Hat</organization> | ||
<organizationUrl>https://www.redhat.com</organizationUrl> | ||
</developer> | ||
<developer> | ||
<name>Elliott Baron</name> | ||
<email>[email protected]</email> | ||
<organization>Red Hat</organization> | ||
<organizationUrl>https://www.redhat.com</organizationUrl> | ||
</developer> | ||
</developers> | ||
|
||
<distributionManagement> | ||
<repository> | ||
|
@@ -18,6 +46,12 @@ | |
</repository> | ||
</distributionManagement> | ||
|
||
<scm> | ||
<connection>scm:git://github.com/cryostatio/cryostat-agent.git</connection> | ||
<developerConnection>scm:git:ssh://github.com:cryostatio/cryostat-agent.git</developerConnection> | ||
<url>https://github.com/cryostatio/cryostat-agent/tree/main</url> | ||
</scm> | ||
|
||
<properties> | ||
<mainClass>io.cryostat.agent.Agent</mainClass> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
|
@@ -67,6 +101,10 @@ | |
<com.google.googlejavaformat.version>1.17.0</com.google.googlejavaformat.version> | ||
<org.jsoup.version>1.15.3</org.jsoup.version> | ||
|
||
<maven-source-plugin.version>3.3.0</maven-source-plugin.version> | ||
<maven-javadoc-plugin.version>3.6.3</maven-javadoc-plugin.version> | ||
<jreleaser-maven-plugin.version>1.10.0</jreleaser-maven-plugin.version> | ||
|
||
<shade.prefix>io.cryostat.agent.shaded</shade.prefix> | ||
</properties> | ||
|
||
|
@@ -498,6 +536,87 @@ | |
</plugins> | ||
</build> | ||
</profile> | ||
|
||
<profile> | ||
<id>release</id> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.jreleaser</groupId> | ||
<artifactId>jreleaser-maven-plugin</artifactId> | ||
<version>${jreleaser-maven-plugin.version}</version> | ||
<inherited>false</inherited> | ||
<configuration> | ||
<jreleaser> | ||
<signing> | ||
<active>ALWAYS</active> | ||
<armored>true</armored> | ||
</signing> | ||
<deploy> | ||
<maven> | ||
<nexus2> | ||
<maven-central> | ||
<active>ALWAYS</active> | ||
<url>https://s01.oss.sonatype.org/service/local</url> | ||
<snapshotUrl>https://s01.oss.sonatype.org/content/repositories/snapshots/</snapshotUrl> | ||
<closeRepository>true</closeRepository> | ||
<releaseRepository>true</releaseRepository> | ||
<stagingRepositories>target/staging-deploy</stagingRepositories> | ||
</maven-central> | ||
</nexus2> | ||
</maven> | ||
</deploy> | ||
</jreleaser> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
|
||
<profile> | ||
<id>publication</id> | ||
<properties> | ||
<altDeploymentRepository>local::file:./target/staging-deploy</altDeploymentRepository> | ||
</properties> | ||
<build> | ||
<defaultGoal>deploy</defaultGoal> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-javadoc-plugin</artifactId> | ||
<version>${maven-javadoc-plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<id>attach-javadocs</id> | ||
<goals> | ||
<goal>jar</goal> | ||
</goals> | ||
<configuration> | ||
<attach>true</attach> | ||
<failOnError>false</failOnError> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-source-plugin</artifactId> | ||
<version>${maven-source-plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<id>attach-sources</id> | ||
<goals> | ||
<goal>jar-no-fork</goal> | ||
</goals> | ||
<configuration> | ||
<attach>true</attach> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
|
||
</project> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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!" |