From 46882bf7525a863e54755c89cbcfe142f0566fb7 Mon Sep 17 00:00:00 2001 From: Victor Garcia Date: Fri, 27 Jun 2025 13:45:56 +0200 Subject: [PATCH 1/2] Adapt to Sonatype Central Publisher Portal --- .github/workflows/main.yml | 47 +++++++------ .github/workflows/master.yml | 34 ++++++---- .mvn/settings.xml | 26 +++++++ pom.xml | 128 +++++++++-------------------------- 4 files changed, 103 insertions(+), 132 deletions(-) create mode 100644 .mvn/settings.xml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ce254c8..0dfd7e2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,24 +1,25 @@ name: Run tests -on: [pull_request] +on: [ pull_request ] jobs: unit-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up JDK 1.7 - uses: actions/setup-java@v1 - with: - java-version: 1.7 - - uses: actions/cache@v1 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - - name: Test - run: mvn clean install -DskipTests=false --update-snapshots -q + - uses: actions/checkout@v4 + - name: Set up JDK 11 + uses: actions/setup-java@v4 + with: + java-version: 11 + distribution: temurin + - uses: actions/cache@v1 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Test + run: mvn clean install -DskipTests=false --update-snapshots -q artifact: name: Publish - Nexus @@ -26,14 +27,16 @@ jobs: needs: unit-test steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Set up JDK 11 - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: - java-version: 11.0.4 + java-version: 11 + distribution: temurin + - name: Release Maven package - uses: samuelmeuli/action-maven-publish@v1 - with: - nexus_username: ${{ secrets.nexus_username }} - nexus_password: ${{ secrets.nexus_password }} - maven_profiles: "branch" \ No newline at end of file + env: + SONATYPE_PORTAL_USERNAME: ${{ secrets.SONATYPE_PORTAL_USERNAME }} + SONATYPE_PORTAL_PASSWORD: ${{ secrets.SONATYPE_PORTAL_PASSWORD }} + run: | + mvn clean deploy --settings .mvn/settings.xml -Dmaven.test.skip=true -B diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 0898096..c0ed9a8 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -9,11 +9,12 @@ jobs: unit-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up JDK 1.7 - uses: actions/setup-java@v1 + - uses: actions/checkout@v4 + - name: Set up JDK 11 + uses: actions/setup-java@v4 with: - java-version: 1.7 + java-version: 11 + distribution: temurin - uses: actions/cache@v1 with: path: ~/.m2/repository @@ -29,18 +30,23 @@ jobs: needs: unit-test steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Set up JDK 11 - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: - java-version: 11.0.4 + java-version: 11 + distribution: temurin + - name: Remove snapshot run: mvn -B versions:set -DremoveSnapshot -DgenerateBackupPoms=false + - name: Release Maven package - uses: samuelmeuli/action-maven-publish@v1 - with: - nexus_username: ${{ secrets.nexus_username }} - nexus_password: ${{ secrets.nexus_password }} - gpg_private_key: ${{ secrets.PGP_PRIVATE_KEY }} - gpg_passphrase: ${{ secrets.PGP_PASSPHRASE }} - maven_profiles: "master" + env: + SONATYPE_PORTAL_USERNAME: ${{ secrets.SONATYPE_PORTAL_USERNAME }} + SONATYPE_PORTAL_PASSWORD: ${{ secrets.SONATYPE_PORTAL_PASSWORD }} + GPG_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} + GPG_SECRET_KEYS: ${{ secrets.PGP_PRIVATE_KEY }} + run: | + echo -e "$GPG_SECRET_KEYS" | gpg --import --no-tty --batch --yes + mvn clean deploy --settings .mvn/settings.xml -Dgpg.skip=false -Dmaven.test.skip=true -B + diff --git a/.mvn/settings.xml b/.mvn/settings.xml new file mode 100644 index 0000000..c27552b --- /dev/null +++ b/.mvn/settings.xml @@ -0,0 +1,26 @@ + + + + + + central + ${env.SONATYPE_PORTAL_USERNAME} + ${env.SONATYPE_PORTAL_PASSWORD} + + + + + + central + + true + + + gpg + ${env.GPG_PASSPHRASE} + + + + diff --git a/pom.xml b/pom.xml index 34041c1..191e272 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ jar DHIS Antlr Expression Parser org.hisp.dhis.parser - 1.0.36 + 1.0.37-SNAPSHOT Antlr Expression Parser @@ -88,6 +88,7 @@ true true 4.9.3 + true @@ -100,94 +101,6 @@ - - branch - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.0.0-M3 - - - enforce-no-releases - - enforce - - - - - No Releases Allowed! - - - true - - - - - - - - - master - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.0.0-M3 - - - enforce-no-snapshots - - enforce - - - - - No Snapshots Allowed! - - - true - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.8 - true - - ossrh - https://oss.sonatype.org/ - true - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.6 - - - sign-artifacts - verify - - sign - - - - - --pinentry-mode - loopback - - - - - - - - @@ -239,13 +152,36 @@ + + org.apache.maven.plugins + maven-gpg-plugin + 3.0.1 + + + --pinentry-mode + loopback + + + + + verify + + sign + + + + + + org.sonatype.central + central-publishing-maven-plugin + 0.8.0 + true + + central + true + DHIS2 ANTLR Expression Parser + + - - - ossrh - Sonatype OSS - https://oss.sonatype.org/content/repositories/snapshots - - From b74f8af9820620fcea7ca487f2620a9742f4410a Mon Sep 17 00:00:00 2001 From: Victor Garcia Date: Fri, 27 Jun 2025 13:48:20 +0200 Subject: [PATCH 2/2] Remove cache step --- .github/workflows/main.yml | 6 ------ .github/workflows/master.yml | 6 ------ 2 files changed, 12 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0dfd7e2..114eb70 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,12 +12,6 @@ jobs: with: java-version: 11 distribution: temurin - - uses: actions/cache@v1 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - name: Test run: mvn clean install -DskipTests=false --update-snapshots -q diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index c0ed9a8..1006fbd 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -15,12 +15,6 @@ jobs: with: java-version: 11 distribution: temurin - - uses: actions/cache@v1 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - name: Test run: mvn clean install -DskipTests=false --update-snapshots -q