From 51c31a7e864e8e0eb56c09940b803c046be59401 Mon Sep 17 00:00:00 2001 From: petruki <31597636+petruki@users.noreply.github.com> Date: Mon, 9 Jun 2025 18:06:49 -0700 Subject: [PATCH] Release 2.2.3, setup pom for migrating to Maven Central for distribution --- .github/workflows/master-2.yml | 16 ++--- .github/workflows/master.yml | 62 ----------------- .github/workflows/release.yml | 63 +++++++++++++++++ .github/workflows/staging.yml | 4 +- pom.xml | 69 +++++++------------ .../client/model/SwitcherRequest.java | 2 +- 6 files changed, 97 insertions(+), 119 deletions(-) delete mode 100644 .github/workflows/master.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/master-2.yml b/.github/workflows/master-2.yml index d173e78f..5965cb09 100644 --- a/.github/workflows/master-2.yml +++ b/.github/workflows/master-2.yml @@ -2,9 +2,9 @@ name: Master CI v2 on: push: - branches: [ master-2 ] + branches: [master-2] pull_request: - branches: [ master-2 ] + branches: [master-2] jobs: build-scan: @@ -30,12 +30,12 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} build-test: - name: Build & Test - JDK ${{ matrix.Java }} on ${{ matrix.os }} + name: Build & Test - JDK ${{ matrix.java }} on ${{ matrix.os }} strategy: fail-fast: false matrix: - java: [ '11', '17', '18', '21'] - os: [ ubuntu-latest, windows-latest ] + java: ['11', '17', '21'] + os: [ubuntu-latest, windows-latest] runs-on: ${{ matrix.os }} if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')" @@ -55,8 +55,8 @@ jobs: uses: actions/cache@v4 with: path: ~/.m2/repository - key: ${{ runner.os }}-m2 - restore-keys: ${{ runner.os }}-m2 + key: ${{ runner.os }}-m2-${{ matrix.java }} + restore-keys: ${{ runner.os }}-m2- - name: Build/Test - run: mvn -B clean package ${{ matrix.jdk }} + run: mvn -B clean package diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml deleted file mode 100644 index 8051f1fd..00000000 --- a/.github/workflows/master.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: Master CI - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build-scan: - name: SonarCloud Scan - runs-on: ubuntu-latest - if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')" - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: 'temurin' - cache: maven - - - name: Build/Test & SonarCloud Scan - run: mvn -B clean verify -Pcoverage,sonar -Dsonar.token=${{ secrets.SONAR_TOKEN }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - build-test: - name: Build & Test - JDK ${{ matrix.Java }} on ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - java: [ '8', '11', '17', '18', '21'] - os: [ ubuntu-latest, windows-latest ] - runs-on: ${{ matrix.os }} - if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')" - - steps: - - uses: actions/checkout@v4 - - - name: Setup Java - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: ${{ matrix.java }} - - - name: Show Versions - run: mvn -version - - - name: Cache Maven packages - uses: actions/cache@v4 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-m2 - restore-keys: ${{ runner.os }}-m2 - - - name: Build/Test - run: mvn -B clean package ${{ matrix.jdk }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..549c4a27 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,63 @@ +name: Release CI v2 + +on: + release: + types: [created] + +jobs: + build-test: + name: Build & Test - JDK ${{ matrix.java }} on ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + java: ['11', '17', '21'] + os: [ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')" + + steps: + - uses: actions/checkout@v4 + + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: ${{ matrix.java }} + + - name: Show Versions + run: mvn -version + + - name: Cache Maven packages + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-m2-${{ matrix.java }} + restore-keys: ${{ runner.os }}-m2- + + - name: Build/Test + run: mvn -B clean package + + publish: + name: Publish Release + needs: [build-test] + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Apache Maven Central + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '11' + server-id: central + server-username: CENTRAL_USERNAME + server-password: CENTRAL_TOKEN + gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + gpg-passphrase: MAVEN_GPG_PASSPHRASE + + - name: Publish to Apache Maven Central + run: mvn deploy -DskipTests -Psign + env: + CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }} + CENTRAL_TOKEN: ${{ secrets.CENTRAL_TOKEN }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} \ No newline at end of file diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 2a8cdf1c..9e8bccf0 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -38,8 +38,8 @@ jobs: uses: actions/cache@v4 with: path: ~/.m2/repository - key: ${{ runner.os }}-m2 - restore-keys: ${{ runner.os }}-m2 + key: ${{ runner.os }}-m2-${{ matrix.java }} + restore-keys: ${{ runner.os }}-m2- - name: Build/Test run: mvn -B clean package \ No newline at end of file diff --git a/pom.xml b/pom.xml index 32fcb30f..9dfb0659 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ com.github.switcherapi switcher-client jar - 2.2.3-SNAPSHOT + 2.2.3 Switcher Client Switcher Client SDK for working with Switcher API @@ -51,28 +51,27 @@ ${java.version} - - 2.12.1 - + 2.13.1 3.17.0 3.11.1 2.0.17 - 5.0.0-alpha.14 - 5.12.0 + 5.0.0-alpha.16 + 5.13.0 2.3.0 + 1.13.0 3.14.0 3.3.1 3.11.2 - 3.4.2 - 3.5.2 + 3.5.3 3.2.7 3.11.0.3922 - 0.8.12 + 0.8.13 + 0.7.0 jacoco @@ -115,13 +114,19 @@ org.junit.jupiter junit-jupiter-engine - ${junit.version} + ${junit-jupiter.version} provided org.junit.jupiter junit-jupiter-params - ${junit.version} + ${junit-jupiter.version} + test + + + org.junit.platform + junit-platform-launcher + ${junit-platform-launcher.version} test @@ -150,34 +155,6 @@ - - - - junit - junit - 4.13.2 - - - - org.junit.platform - junit-platform-launcher - 1.12.0 - test - - - - - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - - ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2 - - - coverage @@ -325,15 +302,15 @@ - + - org.apache.maven.plugins - maven-jar-plugin - ${maven-jar-plugin.version} + org.sonatype.central + central-publishing-maven-plugin + ${central-publishing-maven-plugin.version} + true - - **/log4j2.properties - + central + true diff --git a/src/main/java/com/github/switcherapi/client/model/SwitcherRequest.java b/src/main/java/com/github/switcherapi/client/model/SwitcherRequest.java index c3bfbea4..c1dd188a 100644 --- a/src/main/java/com/github/switcherapi/client/model/SwitcherRequest.java +++ b/src/main/java/com/github/switcherapi/client/model/SwitcherRequest.java @@ -104,7 +104,7 @@ public SwitcherResult submit() throws SwitcherException { } } - final SwitcherResult response = this.switcherExecutor.executeCriteria(this); + final SwitcherResult response = this.executeCriteria(); this.updateHistoryExecution(response); return response; }