openai/openai-java

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
codex/harden-github-actions

Branches

Tags

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

Clone

HTTPS

Download ZIP

.github/workflows/create-releases.yml

97lines · modecode

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