diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ed979ee --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6bfd1f3..1ce08f2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 }} \ No newline at end of file + CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }} + CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 80d6284..db6c986 100644 --- a/pom.xml +++ b/pom.xml @@ -4,24 +4,14 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + in.org.nnm + log4j2-utils + 1.0.0 + jar + log4j2-utils Utility helpers and extensions for Log4j2 configuration and usage https://github.com/Neel1210/log4j2-utils - - scm:git:https://github.com/Neel1210/log4j2-utils.git - scm:git:ssh://github.com/Neel1210/log4j2-utils.git - https://github.com/Neel1210/log4j2-utils - - - - Neelesh Mehar - 1210neelesh@gmail.com - - - - in.org.nnm - log4j2-utils - 1.0.2 @@ -31,12 +21,30 @@ + + + Neelesh Mehar + 1210neelesh@gmail.com + + + + + scm:git:https://github.com/Neel1210/log4j2-utils.git + scm:git:ssh://github.com/Neel1210/log4j2-utils.git + https://github.com/Neel1210/log4j2-utils + + + + GitHub Actions + https://github.com/Neel1210/log4j2-utils/actions + + - true + UTF-8 1.8 1.8 2.24.3 - UTF-8 + true @@ -47,29 +55,52 @@ - - - ossrh - https://s01.oss.sonatype.org/content/repositories/snapshots/ - - - - ossrh - https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ - - - + + org.apache.maven.plugins + maven-compiler-plugin + 3.11.0 + + + + org.apache.logging.log4j + log4j-core + ${log4j2.version} + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.3.1 + + google_checks.xml + true + true + false + + + + validate + validate + + check + + + + org.apache.maven.plugins maven-source-plugin - 3.3.0 + 3.3.1 attach-sources + package - jar + jar-no-fork @@ -81,6 +112,7 @@ attach-javadocs + package jar @@ -100,39 +132,23 @@ - - - org.apache.maven.plugins - maven-compiler-plugin - 3.11.0 - - - org.apache.logging.log4j - log4j-core - ${log4j2.version} - - + + --pinentry-mode + loopback + - org.apache.maven.plugins - maven-checkstyle-plugin - 3.3.1 - google_checks.xml - true - true - false - - - - validate - validate - - check - - - + org.sonatype.central + central-publishing-maven-plugin + 0.7.0 + true + + central + true + published +