openai/openai-java
Publicmirrored from https://github.com/openai/openai-javaAvailable
.github/workflows/create-releases.yml
90lines · modeblame
817fc11astainless-app[bot]1 years ago | 1 | name: Create releases |
| 2 | on: | |
| 3 | schedule: | |
| 4 | - cron: '0 5 * * *' # every day at 5am UTC | |
| 5 | push: | |
| 6 | branches: | |
| 7 | - main | |
| 8 | | |
| 9 | jobs: | |
| 10 | release: | |
| 11 | name: release | |
| 12 | if: github.ref == 'refs/heads/main' && github.repository == 'openai/openai-java' | |
| 13 | runs-on: ubuntu-latest | |
bbb66f87Justin Beckwith2 months ago | 14 | environment: publish |
9323041eJustin Beckwith2 months ago | 15 | outputs: |
| 16 | releases_created: ${{ steps.release.outputs.releases_created }} | |
817fc11astainless-app[bot]1 years ago | 17 | |
| 18 | steps: | |
3349f806Drew Hintz4 months ago | 19 | - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 |
817fc11astainless-app[bot]1 years ago | 20 | |
e2c268ddstainless-app[bot]3 months ago | 21 | - uses: stainless-api/trigger-release-please@bb6677c5a04578eec1ccfd9e1913b5b78ed64c61 # v1.4.0 |
817fc11astainless-app[bot]1 years ago | 22 | id: release |
| 23 | with: | |
| 24 | repo: ${{ github.event.repository.full_name }} | |
| 25 | stainless-api-key: ${{ secrets.STAINLESS_API_KEY }} | |
| 26 | | |
9323041eJustin Beckwith2 months ago | 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 | | |
817fc11astainless-app[bot]1 years ago | 37 | - name: Set up Java |
3349f806Drew Hintz4 months ago | 38 | uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 |
817fc11astainless-app[bot]1 years ago | 39 | with: |
| 40 | distribution: temurin | |
| 41 | java-version: | | |
| 42 | 8 | |
210f88c7stainless-app[bot]11 months ago | 43 | 21 |
817fc11astainless-app[bot]1 years ago | 44 | cache: gradle |
| 45 | | |
| 46 | - name: Set up Gradle | |
3349f806Drew Hintz4 months ago | 47 | uses: gradle/gradle-build-action@fe583dc97e032f41ccc310ea5176f2d7306abbc4 # v2 |
817fc11astainless-app[bot]1 years ago | 48 | |
71cf8abdstainless-app[bot]1 years ago | 49 | - name: Compile the openai-java-core project |
| 50 | run: | | |
| 51 | ./gradlew :openai-java-core:compileJava :openai-java-core:compileTestJava -x test | |
| 52 | | |
af653cffstainless-app[bot]6 months ago | 53 | - name: Run the mock server |
71cf8abdstainless-app[bot]1 years ago | 54 | run: | |
| 55 | ./scripts/mock --daemon | |
| 56 | | |
| 57 | - name: Setup GraalVM | |
3349f806Drew Hintz4 months ago | 58 | uses: graalvm/setup-graalvm@03e8abf916fd0e281b2efe7b2da3378bb0a1d085 # v1 |
71cf8abdstainless-app[bot]1 years ago | 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 | | |
817fc11astainless-app[bot]1 years ago | 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) }')" | |
07bf7aa8stainless-app[bot]12 months ago | 85 | ./gradlew publishAndReleaseToMavenCentral --stacktrace -PmavenCentralUsername="$SONATYPE_USERNAME" -PmavenCentralPassword="$SONATYPE_PASSWORD" --no-configuration-cache |
817fc11astainless-app[bot]1 years ago | 86 | env: |
9323041eJustin Beckwith2 months ago | 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 }} |