Skip to content

Commit 1c13b43

Browse files
committed
Publish Maven packages
1 parent 09ed877 commit 1c13b43

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

.github/workflows/release.yaml

+21
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- "main"
7+
pull_request:
78
tags:
89
- "v[0-9]+.[0-9]+.[0-9]+"
910
workflow_dispatch:
@@ -65,6 +66,7 @@ jobs:
6566
chatgpt-cli.${{ matrix.os }}.exe
6667
6768
push-docker:
69+
if: startsWith(github.ref, 'refs/tags/')
6870
name: Publish Docker Image
6971
runs-on: ubuntu-latest
7072
permissions:
@@ -98,3 +100,22 @@ jobs:
98100
bootBuildImage \
99101
--publishImage \
100102
--parallel
103+
104+
publish-maven-packages:
105+
if: startsWith(github.ref, 'refs/tags/')
106+
name: Publish Maven Packages
107+
runs-on: ubuntu-latest
108+
steps:
109+
- uses: actions/checkout@v3
110+
- uses: graalvm/setup-graalvm@v1
111+
with:
112+
version: '22.3.1'
113+
java-version: '17'
114+
cache: 'gradle'
115+
components: 'native-image'
116+
github-token: ${{ secrets.GITHUB_TOKEN }}
117+
- name: Publish Maven Packages
118+
env:
119+
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
120+
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
121+
run: ./gradlew --no-daemon publish

chatgpt-java-sdk/build.gradle

+2-10
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
group 'io.github.kezhenxu94'
7-
version '0.1.0-SNAPSHOT'
7+
version '0.1.0'
88
sourceCompatibility = '11'
99

1010
repositories {
@@ -29,17 +29,9 @@ publishing {
2929
}
3030
}
3131
repositories {
32-
maven {
33-
name = "GitHubPackages"
34-
url = "https://maven.pkg.github.com/kezhenxu94/chatgpt-java"
35-
credentials {
36-
username = System.getenv("GITHUB_ACTOR")
37-
password = System.getenv("GITHUB_TOKEN")
38-
}
39-
}
4032
maven {
4133
name = "OSSRH"
42-
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
34+
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2"
4335
credentials {
4436
username = System.getenv("MAVEN_USERNAME")
4537
password = System.getenv("MAVEN_PASSWORD")

0 commit comments

Comments
 (0)