Skip to content

Commit eed126d

Browse files
committed
use github release plugin
1 parent 41b74f4 commit eed126d

File tree

2 files changed

+52
-47
lines changed

2 files changed

+52
-47
lines changed

README.md

Lines changed: 24 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,30 @@ works by wrapping HTTPS requests with java variables, making the generated resul
44

55
Feel free to use, modify, and distribute this code as needed.
66

7+
# Installation
8+
For Gradle projects, add this to your `build.gradle` file in the dependencies block:
9+
```groovy
10+
dependencies {
11+
implementation 'com.cjcrafter:openai:1.0.0'
12+
}
13+
```
14+
Or, if you are using Kotlin DSL (`build.gradle.kts`), add this to your dependencies block:
15+
```kotlin
16+
dependencies {
17+
implementation("com.cjcrafter:openai:1.0.0")
18+
}
19+
```
20+
For Maven projects, add this to your `pom.xml` file in the `<dependencies>` block:
21+
```xml
22+
<dependency>
23+
<groupId>com.cjcrafter</groupId>
24+
<artifactId>openai</artifactId>
25+
<version>1.0.0</version>
26+
</dependency>
27+
```
28+
See the [maven repository](https://central.sonatype.com/artifact/com.cjcrafter/openai/1.0.0) for gradle/ant/etc.
29+
30+
731
# Working Example
832
```java
933
import java.io.IOException;
@@ -41,43 +65,6 @@ public class Main {
4165
}
4266
```
4367

44-
# Installation
45-
1. Add [okhttp](https://square.github.io/okhttp/) and [gson](https://github.com/google/gson) as dependencies (see below)
46-
2. Drag and drop the [`ChatBot.java`](https://github.com/CJCrafter/ChatGPT-Java-API/blob/master/ChatBot.java) file into your project
47-
48-
Maven:
49-
```xml
50-
<dependencies>
51-
<dependency>
52-
<groupId>com.squareup.okhttp3</groupId>
53-
<artifactId>okhttp</artifactId>
54-
<version>4.9.2</version>
55-
</dependency>
56-
<dependency>
57-
<groupId>com.google.code.gson</groupId>
58-
<artifactId>gson</artifactId>
59-
<version>2.8.9</version>
60-
</dependency>
61-
</dependencies>
62-
```
63-
64-
Gradle KTS:
65-
```gradle
66-
repositories {
67-
mavenCentral()
68-
}
69-
70-
dependencies {
71-
implementation("com.squareup.okhttp3:okhttp:4.9.2")
72-
implementation("com.google.code.gson:gson:2.8.9")
73-
}
74-
```
75-
76-
# More
77-
1. I also wrote a [Kotlin Version]() of the API.
78-
2. Need inspiration for prompts? Check out [awesome prompts](https://github.com/f/awesome-chatgpt-prompts).
79-
3. Looking for the official API? OpenAI only officially supports [python](https://github.com/openai/openai-python).
80-
8168
# Support
8269
If I have saved you time, please consider [sponsoring me](https://github.com/sponsors/CJCrafter).
8370
If you cannot financially support me, consider leaving a star on the repository and sharing it. Thanks!

build.gradle.kts

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,24 +116,42 @@ tasks.register<GithubReleaseTask>("createGithubRelease").configure {
116116
// https://github.com/BreadMoirai/github-release-gradle-plugin
117117
owner.set("CJCrafter")
118118
repo.set("ChatGPT-Java-API")
119-
authorization.set("Token ${findProperty("GITHUB_PASSWORD").toString()}")
120-
tagName.set(version.toString())
119+
authorization.set("Token ${findProperty("GITHUB_TOKEN").toString()}")
120+
tagName.set("$version")
121121
targetCommitish.set("master")
122-
releaseName.set("v${version} BETA")
123-
draft.set(true)
122+
releaseName.set("$version")
123+
draft.set(false)
124124
prerelease.set(false)
125125
generateReleaseNotes.set(true)
126-
body.set("")
126+
body.set("""
127+
For Gradle projects, add this to your `build.gradle` file in the dependencies block:
128+
```groovy
129+
dependencies {
130+
implementation 'com.cjcrafter:openai:$version'
131+
}
132+
```
133+
Or, if you are using Kotlin DSL (`build.gradle.kts`), add this to your dependencies block:
134+
```kotlin
135+
dependencies {
136+
implementation("com.cjcrafter:openai:$version")
137+
}
138+
```
139+
For Maven projects, add this to your `pom.xml` file in the `<dependencies>` block:
140+
```xml
141+
<dependency>
142+
<groupId>com.cjcrafter</groupId>
143+
<artifactId>openai</artifactId>
144+
<version>$version</version>
145+
</dependency>
146+
```
147+
See the [maven repository](https://central.sonatype.com/artifact/com.cjcrafter/openai/$version) for gradle/ant/etc.
148+
""".trimIndent())
127149
overwrite.set(false)
128150
allowUploadToExisting.set(false)
129151
apiEndpoint.set("https://api.github.com")
130152

131-
setReleaseAssets(/* TODO */)
153+
setReleaseAssets(/* empty */)
132154

133155
// If set to true, you can debug that this would do
134156
dryRun.set(false)
135-
136-
doFirst {
137-
println("Creating GitHub release")
138-
}
139157
}

0 commit comments

Comments
 (0)