Skip to content

Commit d87ca4f

Browse files
committed
[Env] Add publish script
1 parent 5f02df2 commit d87ca4f

3 files changed

Lines changed: 134 additions & 2 deletions

File tree

bin/publish-mavenCentral.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
GPG_TTY=$(tty)
2+
export GPG_TTY
3+
4+
./mvnw clean install package deploy -DskipTests

bin/publish-newVersion.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/sh
2+
VERSION=$1
3+
HOME=$(pwd)
4+
5+
job_before_echo_basic() {
6+
printf "\n\tJob before echo basic \n"
7+
printf "============================================\n"
8+
printf "Released new version\n"
9+
printf "============================================\n\n"
10+
}
11+
12+
job_before_checked() {
13+
printf "\n\tJob before check parameter \n"
14+
printf "============================================\n"
15+
if test -z "$VERSION"; then
16+
printf "Please input version \n"
17+
exit 1
18+
else
19+
printf "Version checked successful | %s\n" "$VERSION"
20+
fi
21+
printf "============================================\n\n"
22+
}
23+
24+
job_runner_apply() {
25+
printf "\n\tJob runner apply \n"
26+
printf "============================================\n"
27+
printf "Apply new version for server ...\n"
28+
MAVEN_OPTS=-Dorg.slf4j.simpleLogger.defaultLogLevel=error ./mvnw versions:set -DnewVersion="$VERSION"
29+
if [ $? -ne 0 ]; then
30+
printf "\nApply new version for server failed\n\n"
31+
exit 1
32+
else
33+
printf "\nApply new version for server successful\n\n"
34+
fi
35+
36+
printf "Apply new version for web ...\n"
37+
# shellcheck disable=SC2164
38+
cd "$HOME"/core/datacap-web
39+
npm version "$VERSION" --no-git-tag-version
40+
if [ $? -ne 0 ]; then
41+
printf "\nApply new version for web failed\n\n"
42+
exit 1
43+
else
44+
printf "\nApply new version for web successful\n\n"
45+
fi
46+
cd "$HOME"
47+
printf "============================================\n\n"
48+
}
49+
50+
job_before_echo_basic
51+
job_before_checked
52+
job_runner_apply

pom.xml

Lines changed: 78 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
<description>
1212
Provides Java developers with a convenient, easy-to-use SDK to interact with OpenAI's apis.
1313
</description>
14-
1514
<url>https://openai-java-sdk.devlive.org</url>
1615

1716
<scm>
18-
<connection>scm:git:git://github.com/devlive-community/openai-java-sdk</connection>
1917
<url>https://github.com/devlive-community/openai-java-sdk</url>
18+
<connection>scm:git:git://github.com/devlive-community/openai-java-sdk</connection>
19+
<tag>openai,jdk,java,chatgpt</tag>
2020
</scm>
2121

2222
<organization>
@@ -58,6 +58,10 @@
5858
<retrofit2.version>2.9.0</retrofit2.version>
5959
<plugin.maven.checkstyle.version>3.0.0</plugin.maven.checkstyle.version>
6060
<plugin.maven.findbugs.version>3.0.5</plugin.maven.findbugs.version>
61+
<plugin.maven.source.version>2.2.1</plugin.maven.source.version>
62+
<plugin.maven.javadoc.version>3.5.0</plugin.maven.javadoc.version>
63+
<plugin.maven.gpg.version>1.6</plugin.maven.gpg.version>
64+
<plugin.maven.nexus.version>1.6</plugin.maven.nexus.version>
6165
</properties>
6266

6367
<dependencies>
@@ -165,6 +169,78 @@
165169
</execution>
166170
</executions>
167171
</plugin>
172+
<plugin>
173+
<groupId>org.apache.maven.plugins</groupId>
174+
<artifactId>maven-source-plugin</artifactId>
175+
<version>${plugin.maven.source.version}</version>
176+
<executions>
177+
<execution>
178+
<phase>package</phase>
179+
<goals>
180+
<goal>jar-no-fork</goal>
181+
</goals>
182+
</execution>
183+
</executions>
184+
</plugin>
185+
<plugin>
186+
<groupId>org.apache.maven.plugins</groupId>
187+
<artifactId>maven-javadoc-plugin</artifactId>
188+
<version>${plugin.maven.javadoc.version}</version>
189+
<executions>
190+
<execution>
191+
<phase>package</phase>
192+
<goals>
193+
<goal>jar</goal>
194+
</goals>
195+
</execution>
196+
</executions>
197+
<configuration>
198+
<tags>
199+
<tag>
200+
<name>Description</name>
201+
<placement>test</placement>
202+
<head>description</head>
203+
</tag>
204+
</tags>
205+
<additionalOptions>-Xdoclint:none</additionalOptions>
206+
<failOnError>false</failOnError>
207+
</configuration>
208+
</plugin>
209+
<plugin>
210+
<groupId>org.apache.maven.plugins</groupId>
211+
<artifactId>maven-gpg-plugin</artifactId>
212+
<version>${plugin.maven.gpg.version}</version>
213+
<executions>
214+
<execution>
215+
<phase>verify</phase>
216+
<goals>
217+
<goal>sign</goal>
218+
</goals>
219+
</execution>
220+
</executions>
221+
</plugin>
222+
<plugin>
223+
<groupId>org.sonatype.plugins</groupId>
224+
<artifactId>nexus-staging-maven-plugin</artifactId>
225+
<version>${plugin.maven.nexus.version}</version>
226+
<extensions>true</extensions>
227+
<configuration>
228+
<serverId>ossrh</serverId>
229+
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
230+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
231+
</configuration>
232+
</plugin>
168233
</plugins>
169234
</build>
235+
236+
<distributionManagement>
237+
<snapshotRepository>
238+
<id>ossrh</id>
239+
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
240+
</snapshotRepository>
241+
<repository>
242+
<id>ossrh</id>
243+
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
244+
</repository>
245+
</distributionManagement>
170246
</project>

0 commit comments

Comments
 (0)