Skip to content

Commit 2b314d7

Browse files
author
McCabe Coats
committed
Publish library on Maven Workflow
This adds a workflow that will publish to Maven when a PR is merged into master.
1 parent a25eceb commit 2b314d7

File tree

7 files changed

+353
-8
lines changed

7 files changed

+353
-8
lines changed

.github/workflows/publish.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Publish package to the Maven Central Repository
2+
on:
3+
push:
4+
branches: [master]
5+
jobs:
6+
publish:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- name: Set up Maven Central Repository
11+
uses: actions/setup-java@v2
12+
with:
13+
java-version: '11'
14+
distribution: 'adopt'
15+
server-id: ossrh
16+
server-username: MAVEN_USERNAME
17+
server-password: MAVEN_PASSWORD
18+
- name: Publish package
19+
run: mvn --batch-mode deploy
20+
env:
21+
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
22+
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ mvn clean package
2828
```
2929

3030
Then manually install the following JARs:
31-
- `target/mx-platform-java-0.2.0.jar`
31+
- `target/mx-platform-java-0.2.1.jar`
3232
- `target/lib/*.jar`
3333

3434
## Getting Started
@@ -59,8 +59,8 @@ public class MxPlatformApiExample {
5959
String memberGuid = "MBR-7c6f361b-e582-15b6-60c0-358f12466b4b"; // String | The unique id for a `member`.
6060
String userGuid = "USR-fa7537f3-48aa-a683-a02a-b18940482f54"; // String | The unique id for a `user`.
6161
try {
62-
MemberResponseBody result = apiInstance.aggregateMember(memberGuid, userGuid);
63-
System.out.println(result);
62+
MemberResponseBody response = apiInstance.aggregateMember(memberGuid, userGuid);
63+
System.out.println(response);
6464
} catch (ApiException e) {
6565
System.err.println("Exception when calling MxPlatformApi#aggregateMember");
6666
System.err.println("Status code: " + e.getCode());

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.2.0
5+
artifactVersion: 0.2.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
@@ -119,8 +119,8 @@ public class {{{classname}}}Example {
119119
{{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}}
120120
{{/allParams}}
121121
try {
122-
{{#returnType}}{{{.}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}}
123-
System.out.println(result);{{/returnType}}
122+
{{#returnType}}{{{.}}} response = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}}
123+
System.out.println(response);{{/returnType}}
124124
} catch (ApiException e) {
125125
System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}");
126126
System.err.println("Status code: " + e.getCode());

openapi/templates/pom.mustache

Lines changed: 312 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,312 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>{{groupId}}</groupId>
5+
<artifactId>{{artifactId}}</artifactId>
6+
<packaging>jar</packaging>
7+
<name>{{artifactId}}</name>
8+
<version>{{artifactVersion}}</version>
9+
<url>{{artifactUrl}}</url>
10+
<description>{{artifactDescription}}</description>
11+
<scm>
12+
<connection>{{scmConnection}}</connection>
13+
<developerConnection>{{scmDeveloperConnection}}</developerConnection>
14+
<url>{{scmUrl}}</url>
15+
</scm>
16+
{{#parentOverridden}}
17+
<parent>
18+
<groupId>{{{parentGroupId}}}</groupId>
19+
<artifactId>{{{parentArtifactId}}}</artifactId>
20+
<version>{{{parentVersion}}}</version>
21+
</parent>
22+
{{/parentOverridden}}
23+
24+
<licenses>
25+
<license>
26+
<name>{{licenseName}}</name>
27+
<url>{{licenseUrl}}</url>
28+
<distribution>repo</distribution>
29+
</license>
30+
</licenses>
31+
32+
<developers>
33+
<developer>
34+
<name>{{developerName}}</name>
35+
<email>{{developerEmail}}</email>
36+
<organization>{{developerOrganization}}</organization>
37+
<organizationUrl>{{developerOrganizationUrl}}</organizationUrl>
38+
</developer>
39+
</developers>
40+
41+
<build>
42+
<plugins>
43+
<plugin>
44+
<groupId>org.apache.maven.plugins</groupId>
45+
<artifactId>maven-compiler-plugin</artifactId>
46+
<version>3.8.1</version>
47+
<configuration>
48+
<fork>true</fork>
49+
<meminitial>128m</meminitial>
50+
<maxmem>512m</maxmem>
51+
<compilerArgs>
52+
<arg>-Xlint:all</arg>
53+
<arg>-J-Xss4m</arg><!-- Compiling the generated JSON.java file may require larger stack size. -->
54+
</compilerArgs>
55+
</configuration>
56+
</plugin>
57+
<plugin>
58+
<groupId>org.apache.maven.plugins</groupId>
59+
<artifactId>maven-enforcer-plugin</artifactId>
60+
<version>3.0.0-M1</version>
61+
<executions>
62+
<execution>
63+
<id>enforce-maven</id>
64+
<goals>
65+
<goal>enforce</goal>
66+
</goals>
67+
<configuration>
68+
<rules>
69+
<requireMavenVersion>
70+
<version>2.2.0</version>
71+
</requireMavenVersion>
72+
</rules>
73+
</configuration>
74+
</execution>
75+
</executions>
76+
</plugin>
77+
<plugin>
78+
<groupId>org.apache.maven.plugins</groupId>
79+
<artifactId>maven-surefire-plugin</artifactId>
80+
<version>3.0.0-M4</version>
81+
<configuration>
82+
<systemProperties>
83+
<property>
84+
<name>loggerPath</name>
85+
<value>conf/log4j.properties</value>
86+
</property>
87+
</systemProperties>
88+
<argLine>-Xms512m -Xmx1500m</argLine>
89+
<parallel>methods</parallel>
90+
<threadCount>10</threadCount>
91+
</configuration>
92+
</plugin>
93+
<plugin>
94+
<artifactId>maven-dependency-plugin</artifactId>
95+
<executions>
96+
<execution>
97+
<phase>package</phase>
98+
<goals>
99+
<goal>copy-dependencies</goal>
100+
</goals>
101+
<configuration>
102+
<outputDirectory>${project.build.directory}/lib</outputDirectory>
103+
</configuration>
104+
</execution>
105+
</executions>
106+
</plugin>
107+
108+
<!-- attach test jar -->
109+
<plugin>
110+
<groupId>org.apache.maven.plugins</groupId>
111+
<artifactId>maven-jar-plugin</artifactId>
112+
<version>2.2</version>
113+
<executions>
114+
<execution>
115+
<goals>
116+
<goal>jar</goal>
117+
<goal>test-jar</goal>
118+
</goals>
119+
</execution>
120+
</executions>
121+
<configuration>
122+
</configuration>
123+
</plugin>
124+
125+
<plugin>
126+
<groupId>org.codehaus.mojo</groupId>
127+
<artifactId>build-helper-maven-plugin</artifactId>
128+
<version>1.10</version>
129+
<executions>
130+
<execution>
131+
<id>add_sources</id>
132+
<phase>generate-sources</phase>
133+
<goals>
134+
<goal>add-source</goal>
135+
</goals>
136+
<configuration>
137+
<sources>
138+
<source>src/main/java</source>
139+
</sources>
140+
</configuration>
141+
</execution>
142+
<execution>
143+
<id>add_test_sources</id>
144+
<phase>generate-test-sources</phase>
145+
<goals>
146+
<goal>add-test-source</goal>
147+
</goals>
148+
<configuration>
149+
<sources>
150+
<source>src/test/java</source>
151+
</sources>
152+
</configuration>
153+
</execution>
154+
</executions>
155+
</plugin>
156+
<plugin>
157+
<groupId>org.apache.maven.plugins</groupId>
158+
<artifactId>maven-javadoc-plugin</artifactId>
159+
<version>3.1.1</version>
160+
<executions>
161+
<execution>
162+
<id>attach-javadocs</id>
163+
<goals>
164+
<goal>jar</goal>
165+
</goals>
166+
</execution>
167+
</executions>
168+
<configuration>
169+
<doclint>none</doclint>
170+
<tags>
171+
<tag>
172+
<name>http.response.details</name>
173+
<placement>a</placement>
174+
<head>Http Response Details:</head>
175+
</tag>
176+
</tags>
177+
</configuration>
178+
</plugin>
179+
<plugin>
180+
<groupId>org.apache.maven.plugins</groupId>
181+
<artifactId>maven-source-plugin</artifactId>
182+
<version>2.2.1</version>
183+
<executions>
184+
<execution>
185+
<id>attach-sources</id>
186+
<goals>
187+
<goal>jar-no-fork</goal>
188+
</goals>
189+
</execution>
190+
</executions>
191+
</plugin>
192+
</plugins>
193+
</build>
194+
195+
<distributionManagement>
196+
<snapshotRepository>
197+
<id>ossrh</id>
198+
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
199+
</snapshotRepository>
200+
<repository>
201+
<id>ossrh</id>
202+
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
203+
</repository>
204+
</distributionManagement>
205+
206+
<profiles>
207+
<profile>
208+
<id>sign-artifacts</id>
209+
<build>
210+
<plugins>
211+
<plugin>
212+
<groupId>org.apache.maven.plugins</groupId>
213+
<artifactId>maven-gpg-plugin</artifactId>
214+
<version>1.5</version>
215+
<executions>
216+
<execution>
217+
<id>sign-artifacts</id>
218+
<phase>verify</phase>
219+
<goals>
220+
<goal>sign</goal>
221+
</goals>
222+
</execution>
223+
</executions>
224+
</plugin>
225+
</plugins>
226+
</build>
227+
</profile>
228+
</profiles>
229+
230+
<dependencies>
231+
<dependency>
232+
<groupId>io.swagger</groupId>
233+
<artifactId>swagger-annotations</artifactId>
234+
<version>${swagger-core-version}</version>
235+
</dependency>
236+
<!-- @Nullable annotation -->
237+
<dependency>
238+
<groupId>com.google.code.findbugs</groupId>
239+
<artifactId>jsr305</artifactId>
240+
<version>3.0.2</version>
241+
</dependency>
242+
<dependency>
243+
<groupId>com.squareup.okhttp3</groupId>
244+
<artifactId>okhttp</artifactId>
245+
<version>${okhttp-version}</version>
246+
</dependency>
247+
<dependency>
248+
<groupId>com.squareup.okhttp3</groupId>
249+
<artifactId>logging-interceptor</artifactId>
250+
<version>${okhttp-version}</version>
251+
</dependency>
252+
<dependency>
253+
<groupId>com.google.code.gson</groupId>
254+
<artifactId>gson</artifactId>
255+
<version>${gson-version}</version>
256+
</dependency>
257+
<dependency>
258+
<groupId>io.gsonfire</groupId>
259+
<artifactId>gson-fire</artifactId>
260+
<version>${gson-fire-version}</version>
261+
</dependency>
262+
<dependency>
263+
<groupId>org.apache.commons</groupId>
264+
<artifactId>commons-lang3</artifactId>
265+
<version>${commons-lang3-version}</version>
266+
</dependency>
267+
<dependency>
268+
<groupId>org.threeten</groupId>
269+
<artifactId>threetenbp</artifactId>
270+
<version>${threetenbp-version}</version>
271+
</dependency>
272+
<dependency>
273+
<groupId>javax.annotation</groupId>
274+
<artifactId>javax.annotation-api</artifactId>
275+
<version>${javax-annotation-version}</version>
276+
<scope>provided</scope>
277+
</dependency>
278+
<dependency>
279+
<groupId>org.openapitools</groupId>
280+
<artifactId>jackson-databind-nullable</artifactId>
281+
<version>${jackson-databind-nullable-version}</version>
282+
</dependency>
283+
<!-- test dependencies -->
284+
<dependency>
285+
<groupId>junit</groupId>
286+
<artifactId>junit</artifactId>
287+
<version>${junit-version}</version>
288+
<scope>test</scope>
289+
</dependency>
290+
<dependency>
291+
<groupId>org.mockito</groupId>
292+
<artifactId>mockito-core</artifactId>
293+
<version>3.11.2</version>
294+
<scope>test</scope>
295+
</dependency>
296+
</dependencies>
297+
<properties>
298+
<java.version>1.7</java.version>
299+
<maven.compiler.source>${java.version}</maven.compiler.source>
300+
<maven.compiler.target>${java.version}</maven.compiler.target>
301+
<gson-fire-version>1.8.5</gson-fire-version>
302+
<swagger-core-version>1.6.2</swagger-core-version>
303+
<okhttp-version>4.9.1</okhttp-version>
304+
<gson-version>2.8.6</gson-version>
305+
<commons-lang3-version>3.11</commons-lang3-version>
306+
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
307+
<threetenbp-version>1.5.0</threetenbp-version>
308+
<javax-annotation-version>1.3.2</javax-annotation-version>
309+
<junit-version>4.13.1</junit-version>
310+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
311+
</properties>
312+
</project>

0 commit comments

Comments
 (0)