Skip to content

Commit 0b829e0

Browse files
authored
Release 2.2.3, setup pom for migrating to Maven Central for distribution (#341)
1 parent 14c7074 commit 0b829e0

File tree

6 files changed

+97
-119
lines changed

6 files changed

+97
-119
lines changed

.github/workflows/master-2.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Master CI v2
22

33
on:
44
push:
5-
branches: [ master-2 ]
5+
branches: [master-2]
66
pull_request:
7-
branches: [ master-2 ]
7+
branches: [master-2]
88

99
jobs:
1010
build-scan:
@@ -30,12 +30,12 @@ jobs:
3030
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3131

3232
build-test:
33-
name: Build & Test - JDK ${{ matrix.Java }} on ${{ matrix.os }}
33+
name: Build & Test - JDK ${{ matrix.java }} on ${{ matrix.os }}
3434
strategy:
3535
fail-fast: false
3636
matrix:
37-
java: [ '11', '17', '18', '21']
38-
os: [ ubuntu-latest, windows-latest ]
37+
java: ['11', '17', '21']
38+
os: [ubuntu-latest, windows-latest]
3939
runs-on: ${{ matrix.os }}
4040
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
4141

@@ -55,8 +55,8 @@ jobs:
5555
uses: actions/cache@v4
5656
with:
5757
path: ~/.m2/repository
58-
key: ${{ runner.os }}-m2
59-
restore-keys: ${{ runner.os }}-m2
58+
key: ${{ runner.os }}-m2-${{ matrix.java }}
59+
restore-keys: ${{ runner.os }}-m2-
6060

6161
- name: Build/Test
62-
run: mvn -B clean package ${{ matrix.jdk }}
62+
run: mvn -B clean package

.github/workflows/master.yml

Lines changed: 0 additions & 62 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Release CI v2
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
build-test:
9+
name: Build & Test - JDK ${{ matrix.java }} on ${{ matrix.os }}
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
java: ['11', '17', '21']
14+
os: [ubuntu-latest, windows-latest]
15+
runs-on: ${{ matrix.os }}
16+
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Setup Java
22+
uses: actions/setup-java@v4
23+
with:
24+
distribution: 'temurin'
25+
java-version: ${{ matrix.java }}
26+
27+
- name: Show Versions
28+
run: mvn -version
29+
30+
- name: Cache Maven packages
31+
uses: actions/cache@v4
32+
with:
33+
path: ~/.m2/repository
34+
key: ${{ runner.os }}-m2-${{ matrix.java }}
35+
restore-keys: ${{ runner.os }}-m2-
36+
37+
- name: Build/Test
38+
run: mvn -B clean package
39+
40+
publish:
41+
name: Publish Release
42+
needs: [build-test]
43+
runs-on: ubuntu-latest
44+
45+
steps:
46+
- uses: actions/checkout@v4
47+
- name: Set up Apache Maven Central
48+
uses: actions/setup-java@v4
49+
with:
50+
distribution: 'temurin'
51+
java-version: '11'
52+
server-id: central
53+
server-username: CENTRAL_USERNAME
54+
server-password: CENTRAL_TOKEN
55+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
56+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
57+
58+
- name: Publish to Apache Maven Central
59+
run: mvn deploy -DskipTests -Psign
60+
env:
61+
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
62+
CENTRAL_TOKEN: ${{ secrets.CENTRAL_TOKEN }}
63+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

.github/workflows/staging.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ jobs:
3838
uses: actions/cache@v4
3939
with:
4040
path: ~/.m2/repository
41-
key: ${{ runner.os }}-m2
42-
restore-keys: ${{ runner.os }}-m2
41+
key: ${{ runner.os }}-m2-${{ matrix.java }}
42+
restore-keys: ${{ runner.os }}-m2-
4343

4444
- name: Build/Test
4545
run: mvn -B clean package

pom.xml

Lines changed: 23 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<groupId>com.github.switcherapi</groupId>
99
<artifactId>switcher-client</artifactId>
1010
<packaging>jar</packaging>
11-
<version>2.2.3-SNAPSHOT</version>
11+
<version>2.2.3</version>
1212

1313
<name>Switcher Client</name>
1414
<description>Switcher Client SDK for working with Switcher API</description>
@@ -51,28 +51,27 @@
5151
<maven.compiler.target>${java.version}</maven.compiler.target>
5252
<argLine />
5353

54-
<!-- rest/json libs -->
55-
<gson.version>2.12.1</gson.version>
56-
5754
<!-- utils -->
55+
<gson.version>2.13.1</gson.version>
5856
<commons-lang3.version>3.17.0</commons-lang3.version>
5957
<commons-net.version>3.11.1</commons-net.version>
6058
<slf4j-api.version>2.0.17</slf4j-api.version>
6159

6260
<!-- test -->
63-
<okhttp.version>5.0.0-alpha.14</okhttp.version>
64-
<junit.version>5.12.0</junit.version>
61+
<okhttp.version>5.0.0-alpha.16</okhttp.version>
62+
<junit-jupiter.version>5.13.0</junit-jupiter.version>
6563
<junit-pioneer.version>2.3.0</junit-pioneer.version>
64+
<junit-platform-launcher.version>1.13.0</junit-platform-launcher.version>
6665

6766
<!-- Plugins -->
6867
<maven-compiler-plugin.version>3.14.0</maven-compiler-plugin.version>
6968
<maven-source-plugin.version>3.3.1</maven-source-plugin.version>
7069
<maven-javadoc-plugin.version>3.11.2</maven-javadoc-plugin.version>
71-
<maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
72-
<maven-surefire-plugin.version>3.5.2</maven-surefire-plugin.version>
70+
<maven-surefire-plugin.version>3.5.3</maven-surefire-plugin.version>
7371
<maven-gpg-plugin.version>3.2.7</maven-gpg-plugin.version>
7472
<sonar-maven-plugin.version>3.11.0.3922</sonar-maven-plugin.version>
75-
<jacoco-maven-plugin.version>0.8.12</jacoco-maven-plugin.version>
73+
<jacoco-maven-plugin.version>0.8.13</jacoco-maven-plugin.version>
74+
<central-publishing-maven-plugin.version>0.7.0</central-publishing-maven-plugin.version>
7675

7776
<!-- Sonar -->
7877
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
@@ -115,13 +114,19 @@
115114
<dependency>
116115
<groupId>org.junit.jupiter</groupId>
117116
<artifactId>junit-jupiter-engine</artifactId>
118-
<version>${junit.version}</version>
117+
<version>${junit-jupiter.version}</version>
119118
<scope>provided</scope>
120119
</dependency>
121120
<dependency>
122121
<groupId>org.junit.jupiter</groupId>
123122
<artifactId>junit-jupiter-params</artifactId>
124-
<version>${junit.version}</version>
123+
<version>${junit-jupiter.version}</version>
124+
<scope>test</scope>
125+
</dependency>
126+
<dependency>
127+
<groupId>org.junit.platform</groupId>
128+
<artifactId>junit-platform-launcher</artifactId>
129+
<version>${junit-platform-launcher.version}</version>
125130
<scope>test</scope>
126131
</dependency>
127132
<dependency>
@@ -150,34 +155,6 @@
150155
</dependency>
151156
</dependencies>
152157

153-
<dependencyManagement>
154-
<dependencies>
155-
<dependency>
156-
<groupId>junit</groupId>
157-
<artifactId>junit</artifactId>
158-
<version>4.13.2</version>
159-
</dependency>
160-
161-
<dependency>
162-
<groupId>org.junit.platform</groupId>
163-
<artifactId>junit-platform-launcher</artifactId>
164-
<version>1.12.0</version>
165-
<scope>test</scope>
166-
</dependency>
167-
</dependencies>
168-
</dependencyManagement>
169-
170-
<distributionManagement>
171-
<snapshotRepository>
172-
<id>ossrh</id>
173-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
174-
</snapshotRepository>
175-
<repository>
176-
<id>ossrh</id>
177-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
178-
</repository>
179-
</distributionManagement>
180-
181158
<profiles>
182159
<profile>
183160
<id>coverage</id>
@@ -325,15 +302,15 @@
325302
</configuration>
326303
</plugin>
327304

328-
<!-- Exclude log4j2 properties -->
305+
<!-- Publish to Maven Central -->
329306
<plugin>
330-
<groupId>org.apache.maven.plugins</groupId>
331-
<artifactId>maven-jar-plugin</artifactId>
332-
<version>${maven-jar-plugin.version}</version>
307+
<groupId>org.sonatype.central</groupId>
308+
<artifactId>central-publishing-maven-plugin</artifactId>
309+
<version>${central-publishing-maven-plugin.version}</version>
310+
<extensions>true</extensions>
333311
<configuration>
334-
<excludes>
335-
<exclude>**/log4j2.properties</exclude>
336-
</excludes>
312+
<publishingServerId>central</publishingServerId>
313+
<autoPublish>true</autoPublish>
337314
</configuration>
338315
</plugin>
339316
</plugins>

src/main/java/com/github/switcherapi/client/model/SwitcherRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public SwitcherResult submit() throws SwitcherException {
104104
}
105105
}
106106

107-
final SwitcherResult response = this.switcherExecutor.executeCriteria(this);
107+
final SwitcherResult response = this.executeCriteria();
108108
this.updateHistoryExecution(response);
109109
return response;
110110
}

0 commit comments

Comments
 (0)