openai/openai-java

Public

mirrored from https://github.com/openai/openai-javaAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v4.41.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

.github/workflows/publish-sonatype.yml

69lines · modecode

1# workflow for re-running publishing to Sonatype in case it fails for some reason
2# you can run this workflow by navigating to https://www.github.com/openai/openai-java/actions/workflows/publish-sonatype.yml
3name: Publish Sonatype
4on:
5 workflow_dispatch:
6
7jobs:
8 publish:
9 name: publish
10 runs-on: ubuntu-latest
11 environment: publish
12
13 steps:
14 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
15
16 - name: Set up Java
17 uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
18 with:
19 distribution: temurin
20 java-version: |
21 8
22 21
23 cache: gradle
24
25 - name: Set up Gradle
26 uses: gradle/gradle-build-action@fe583dc97e032f41ccc310ea5176f2d7306abbc4 # v2
27
28 - name: Compile the openai-java-core project
29 run: |
30 ./gradlew :openai-java-core:compileJava :openai-java-core:compileTestJava -x test
31
32 - name: Run the mock server
33 run: |
34 ./scripts/mock --daemon
35
36 - name: Setup GraalVM
37 uses: graalvm/setup-graalvm@03e8abf916fd0e281b2efe7b2da3378bb0a1d085 # v1
38 with:
39 java-version: 21
40 distribution: 'graalvm-community'
41 cache: gradle
42
43 - name: Run tests on the openai-java-core project with the GraalVM native-image agent
44 run: |
45 ./gradlew :openai-java-core:test -x compileJava -x compileTestJava -x compileKotlin -x compileTestKotlin -PgraalvmAgent
46
47 - name: Check generated GraalVM file
48 run: |
49 echo "Checking for GraalVM agent metadata files..."
50 DIRECTORY=openai-java-core/src/main/resources/META-INF/native-image
51 if [ -d "$DIRECTORY" ] && [ "$(ls -A $DIRECTORY)" ]; then
52 echo "Files found in $DIRECTORY:"
53 ls -l $DIRECTORY
54 else
55 echo "No files found in $DIRECTORY"
56 exit 1
57 fi
58
59 - name: Publish to Sonatype
60 run: |-
61 export -- GPG_SIGNING_KEY_ID
62 printenv -- GPG_SIGNING_KEY | gpg --batch --passphrase-fd 3 --import 3<<< "$GPG_SIGNING_PASSWORD"
63 GPG_SIGNING_KEY_ID="$(gpg --with-colons --list-keys | awk -F : -- '/^pub:/ { getline; print "0x" substr($10, length($10) - 7) }')"
64 ./gradlew publishAndReleaseToMavenCentral --stacktrace -PmavenCentralUsername="$SONATYPE_USERNAME" -PmavenCentralPassword="$SONATYPE_PASSWORD" --no-configuration-cache
65 env:
66 SONATYPE_USERNAME: ${{ secrets.OPENAI_SONATYPE_USERNAME }}
67 SONATYPE_PASSWORD: ${{ secrets.OPENAI_SONATYPE_PASSWORD }}
68 GPG_SIGNING_KEY: ${{ secrets.OPENAI_SONATYPE_GPG_SIGNING_KEY }}
69 GPG_SIGNING_PASSWORD: ${{ secrets.OPENAI_SONATYPE_GPG_SIGNING_PASSWORD }}
70