Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Java CI Build

on:
push:
branches:
- '**'
pull_request:
branches:
- '**'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'temurin'
cache: 'maven'

- name: Build with Maven
run: |
mvn clean install -B -Dgpg.skip=true
55 changes: 35 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,51 @@
name: Release to Maven Central
name: Maven Central Publish

on:
push:
tags:
- 'v*'
release:
types: [published]

jobs:
release:
publish:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout source
- name: Checkout Code
uses: actions/checkout@v4

- name: Set up JDK 8 + Maven Central
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'

# Sonatype OSSRH (s01)
server-id: ossrh
server-username: OSSRH_USERNAME
server-password: OSSRH_PASSWORD

# GPG signing
distribution: 'temurin'
cache: 'maven'
server-id: central
server-username: CENTRAL_USERNAME
server-password: CENTRAL_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: GPG_PASSPHRASE

- name: Deploy to Sonatype
run: mvn clean deploy
- name: Verify Version Match
run: |
POM_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
TAG_VERSION=${{ github.event.release.tag_name }}
# Remove 'v' prefix if you use tags like v1.0.0
TAG_VERSION=${TAG_VERSION#v}

echo "POM Version: $POM_VERSION"
echo "Tag Version: $TAG_VERSION"

if [ "$POM_VERSION" != "$TAG_VERSION" ]; then
echo "Error: POM version ($POM_VERSION) does not match Tag ($TAG_VERSION)"
exit 1
fi

- name: Publish to Sonatype Central
run: |
mvn clean deploy -B \
-Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} \
-DskipTests
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }}
136 changes: 76 additions & 60 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,14 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>in.org.nnm</groupId>
<artifactId>log4j2-utils</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>

<name>log4j2-utils</name>
<description>Utility helpers and extensions for Log4j2 configuration and usage</description>
<url>https://github.com/Neel1210/log4j2-utils</url>
<scm>
<connection>scm:git:https://github.com/Neel1210/log4j2-utils.git</connection>
<developerConnection>scm:git:ssh://github.com/Neel1210/log4j2-utils.git</developerConnection>
<url>https://github.com/Neel1210/log4j2-utils</url>
</scm>
<developers>
<developer>
<name>Neelesh Mehar</name>
<email>1210neelesh@gmail.com</email>
</developer>
</developers>

<groupId>in.org.nnm</groupId>
<artifactId>log4j2-utils</artifactId>
<version>1.0.2</version>

<licenses>
<license>
Expand All @@ -31,12 +21,30 @@
</license>
</licenses>

<developers>
<developer>
<name>Neelesh Mehar</name>
<email>1210neelesh@gmail.com</email>
</developer>
</developers>

<scm>
<connection>scm:git:https://github.com/Neel1210/log4j2-utils.git</connection>
<developerConnection>scm:git:ssh://github.com/Neel1210/log4j2-utils.git</developerConnection>
<url>https://github.com/Neel1210/log4j2-utils</url>
</scm>

<ciManagement>
<system>GitHub Actions</system>
<url>https://github.com/Neel1210/log4j2-utils/actions</url>
</ciManagement>

<properties>
<maven.test.skip>true</maven.test.skip>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<log4j2.version>2.24.3</log4j2.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.test.skip>true</maven.test.skip>
</properties>

<dependencies>
Expand All @@ -47,29 +55,52 @@
</dependency>
</dependencies>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
</snapshotRepository>

<repository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j2.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<configLocation>google_checks.xml</configLocation>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
</configuration>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<version>3.3.1</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
Expand All @@ -81,6 +112,7 @@
<executions>
<execution>
<id>attach-javadocs</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
Expand All @@ -100,39 +132,23 @@
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j2.version}</version>
</path>
</annotationProcessorPaths>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.3.1</version> <configuration>
<configLocation>google_checks.xml</configLocation>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
</configuration>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.7.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
<autoPublish>true</autoPublish>
<waitUntil>published</waitUntil>
</configuration>
</plugin>
</plugins>
</build>
Expand Down