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/create-releases.yml

90lines · modecode

1name: Create releases
2on:
3 schedule:
4 - cron: '0 5 * * *' # every day at 5am UTC
5 push:
6 branches:
7 - main
8
9jobs:
10 release:
11 name: release
12 if: github.ref == 'refs/heads/main' && github.repository == 'openai/openai-java'
13 runs-on: ubuntu-latest
14 environment: publish
15 outputs:
16 releases_created: ${{ steps.release.outputs.releases_created }}
17
18 steps:
19 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
20
21 - uses: stainless-api/trigger-release-please@bb6677c5a04578eec1ccfd9e1913b5b78ed64c61 # v1.4.0
22 id: release
23 with:
24 repo: ${{ github.event.repository.full_name }}
25 stainless-api-key: ${{ secrets.STAINLESS_API_KEY }}
26
27 publish:
28 name: publish
29 needs: release
30 if: ${{ needs.release.outputs.releases_created == 'true' }}
31 runs-on: ubuntu-latest
32 environment: publish
33
34 steps:
35 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
36
37 - name: Set up Java
38 uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
39 with:
40 distribution: temurin
41 java-version: |
42 8
43 21
44 cache: gradle
45
46 - name: Set up Gradle
47 uses: gradle/gradle-build-action@fe583dc97e032f41ccc310ea5176f2d7306abbc4 # v2
48
49 - name: Compile the openai-java-core project
50 run: |
51 ./gradlew :openai-java-core:compileJava :openai-java-core:compileTestJava -x test
52
53 - name: Run the mock server
54 run: |
55 ./scripts/mock --daemon
56
57 - name: Setup GraalVM
58 uses: graalvm/setup-graalvm@03e8abf916fd0e281b2efe7b2da3378bb0a1d085 # v1
59 with:
60 java-version: 21
61 distribution: 'graalvm-community'
62 cache: gradle
63
64 - name: Run tests on the openai-java-core project with the GraalVM native-image agent
65 run: |
66 ./gradlew :openai-java-core:test -x compileJava -x compileTestJava -x compileKotlin -x compileTestKotlin -PgraalvmAgent
67
68 - name: Check generated GraalVM file
69 run: |
70 echo "Checking for GraalVM agent metadata files..."
71 DIRECTORY=openai-java-core/src/main/resources/META-INF/native-image
72 if [ -d "$DIRECTORY" ] && [ "$(ls -A $DIRECTORY)" ]; then
73 echo "Files found in $DIRECTORY:"
74 ls -l $DIRECTORY
75 else
76 echo "No files found in $DIRECTORY"
77 exit 1
78 fi
79
80 - name: Publish to Sonatype
81 run: |-
82 export -- GPG_SIGNING_KEY_ID
83 printenv -- GPG_SIGNING_KEY | gpg --batch --passphrase-fd 3 --import 3<<< "$GPG_SIGNING_PASSWORD"
84 GPG_SIGNING_KEY_ID="$(gpg --with-colons --list-keys | awk -F : -- '/^pub:/ { getline; print "0x" substr($10, length($10) - 7) }')"
85 ./gradlew publishAndReleaseToMavenCentral --stacktrace -PmavenCentralUsername="$SONATYPE_USERNAME" -PmavenCentralPassword="$SONATYPE_PASSWORD" --no-configuration-cache
86 env:
87 SONATYPE_USERNAME: ${{ secrets.OPENAI_SONATYPE_USERNAME }}
88 SONATYPE_PASSWORD: ${{ secrets.OPENAI_SONATYPE_PASSWORD }}
89 GPG_SIGNING_KEY: ${{ secrets.OPENAI_SONATYPE_GPG_SIGNING_KEY }}
90 GPG_SIGNING_PASSWORD: ${{ secrets.OPENAI_SONATYPE_GPG_SIGNING_PASSWORD }}
91