Skip to content

Commit a24412b

Browse files
Merge pull request #25 from mxenabled/bm/publish_java
Publish Java library with GitHub Action
2 parents 592c8a6 + 55bd3ff commit a24412b

7 files changed

Lines changed: 72 additions & 23 deletions

File tree

.github/workflows/publish.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
branches: [master]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Set up JDK 11
14+
uses: actions/setup-java@v2
15+
with:
16+
distribution: 'temurin'
17+
java-version: '11'
18+
19+
- name: Build with Maven
20+
run: mvn -B package --file pom.xml
21+
22+
- name: Set up Apache Maven Central
23+
uses: actions/setup-java@v2
24+
with:
25+
distribution: 'temurin'
26+
java-version: '11'
27+
server-id: ossrh
28+
server-username: MAVEN_USERNAME
29+
server-password: MAVEN_CENTRAL_TOKEN
30+
gpg-private-key: MAVEN_GPG_PRIVATE_KEY
31+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
32+
33+
- name: Publish to Apache Maven Central
34+
run: mvn deploy -P sign-artifacts
35+
env:
36+
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
37+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
38+
MAVEN_GPG_PRIVATE_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
39+
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ mvn clean package
2424
```
2525

2626
Then manually install the following JARs:
27-
- `target/mx-platform-java-0.4.0.jar`
27+
- `target/mx-platform-java-0.4.1.jar`
2828
- `target/lib/*.jar`
2929

3030
### Maven users
@@ -35,7 +35,7 @@ Add this dependency to your project's POM:
3535
<dependency>
3636
<groupId>com.mx</groupId>
3737
<artifactId>mx-platform-java</artifactId>
38-
<version>0.4.0</version>
38+
<version>0.4.1</version>
3939
<scope>compile</scope>
4040
</dependency>
4141
```
@@ -55,6 +55,7 @@ import com.mx.client.Configuration;
5555
import com.mx.client.auth.*;
5656
import com.mx.client.model.*;
5757
import com.mx.client.mx_platform_api.MxPlatformApi;
58+
import java.util.*;
5859

5960
public class Example {
6061
public static void main(String[] args) {
@@ -69,10 +70,9 @@ public class Example {
6970

7071
MxPlatformApi apiInstance = new MxPlatformApi(defaultClient);
7172

73+
UserCreateRequestBody userCreateRequestBody = new UserCreateRequestBody();
7274
UserCreateRequest userCreateRequest = new UserCreateRequest();
7375
userCreateRequest.setMetadata("Creating a user!");
74-
75-
UserCreateRequestBody userCreateRequestBody = new UserCreateRequestBody();
7676
userCreateRequestBody.setUser(userCreateRequest);
7777

7878
try {

openapi/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiPackage: "com.mx.client.mx-platform-api"
22
artifactDescription: "A Java library for the MX Platform API"
33
artifactId: "mx-platform-java"
44
artifactUrl: "https://github.com/mxenabled/mx-platform-java"
5-
artifactVersion: 0.4.0
5+
artifactVersion: 0.4.1
66
developerEmail: "devexperience@mx.com"
77
developerName: "MX"
88
developerOrganization: "MX Technologies Inc."

openapi/templates/README.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ import com.mx.client.Configuration;
5555
import com.mx.client.auth.*;
5656
import com.mx.client.model.*;
5757
import com.mx.client.mx_platform_api.MxPlatformApi;
58+
import java.util.*;
5859

5960
public class Example {
6061
public static void main(String[] args) {
@@ -69,10 +70,9 @@ public class Example {
6970
7071
MxPlatformApi apiInstance = new MxPlatformApi(defaultClient);
7172
73+
UserCreateRequestBody userCreateRequestBody = new UserCreateRequestBody();
7274
UserCreateRequest userCreateRequest = new UserCreateRequest();
7375
userCreateRequest.setMetadata("Creating a user!");
74-
75-
UserCreateRequestBody userCreateRequestBody = new UserCreateRequestBody();
7676
userCreateRequestBody.setUser(userCreateRequest);
7777
7878
try {

openapi/templates/pom.mustache

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,17 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
189189
</execution>
190190
</executions>
191191
</plugin>
192+
<plugin>
193+
<groupId>org.sonatype.plugins</groupId>
194+
<artifactId>nexus-staging-maven-plugin</artifactId>
195+
<version>1.6.7</version>
196+
<extensions>true</extensions>
197+
<configuration>
198+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
199+
<serverId>ossrh</serverId>
200+
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
201+
</configuration>
202+
</plugin>
192203
</plugins>
193204
</build>
194205

@@ -211,7 +222,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
211222
<plugin>
212223
<groupId>org.apache.maven.plugins</groupId>
213224
<artifactId>maven-gpg-plugin</artifactId>
214-
<version>1.5</version>
225+
<version>3.0.1</version>
215226
<executions>
216227
<execution>
217228
<id>sign-artifacts</id>
@@ -221,12 +232,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
221232
</goals>
222233
</execution>
223234
</executions>
224-
<configuration>
225-
<gpgArguments>
226-
<arg>--pinentry-mode</arg>
227-
<arg>loopback</arg>
228-
</gpgArguments>
229-
</configuration>
230235
</plugin>
231236
</plugins>
232237
</build>

pom.xml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
55
<artifactId>mx-platform-java</artifactId>
66
<packaging>jar</packaging>
77
<name>mx-platform-java</name>
8-
<version>0.4.0</version>
8+
<version>0.4.1</version>
99
<url>https://github.com/mxenabled/mx-platform-java</url>
1010
<description>A Java library for the MX Platform API</description>
1111
<scm>
@@ -182,6 +182,17 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
182182
</execution>
183183
</executions>
184184
</plugin>
185+
<plugin>
186+
<groupId>org.sonatype.plugins</groupId>
187+
<artifactId>nexus-staging-maven-plugin</artifactId>
188+
<version>1.6.7</version>
189+
<extensions>true</extensions>
190+
<configuration>
191+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
192+
<serverId>ossrh</serverId>
193+
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
194+
</configuration>
195+
</plugin>
185196
</plugins>
186197
</build>
187198

@@ -204,7 +215,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
204215
<plugin>
205216
<groupId>org.apache.maven.plugins</groupId>
206217
<artifactId>maven-gpg-plugin</artifactId>
207-
<version>1.5</version>
218+
<version>3.0.1</version>
208219
<executions>
209220
<execution>
210221
<id>sign-artifacts</id>
@@ -214,12 +225,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
214225
</goals>
215226
</execution>
216227
</executions>
217-
<configuration>
218-
<gpgArguments>
219-
<arg>--pinentry-mode</arg>
220-
<arg>loopback</arg>
221-
</gpgArguments>
222-
</configuration>
223228
</plugin>
224229
</plugins>
225230
</build>

src/main/java/com/mx/client/ApiClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ private void init() {
125125
json = new JSON();
126126

127127
// Set default User-Agent.
128-
setUserAgent("OpenAPI-Generator/0.4.0/java");
128+
setUserAgent("OpenAPI-Generator/0.4.1/java");
129129

130130
authentications = new HashMap<String, Authentication>();
131131
}

0 commit comments

Comments
 (0)