openai/openai-java

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
d3ad00a6fee98e0de92ed58c456a0782a54a9adb

Branches

Tags

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

Clone

HTTPS

Download ZIP

.github/workflows/create-releases.yml

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