Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 67 additions & 26 deletions .github/workflows/create-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ on:
type: boolean
default: false

permissions:
contents: read
permissions: {}

concurrency:
group: create-releases
Expand All @@ -31,36 +30,49 @@ env:
MAVEN_ARTIFACTS: openai-java openai-java-core openai-java-client-okhttp openai-java-bedrock

jobs:
release:
name: Release / select source
if: github.ref == 'refs/heads/main' && github.repository == 'openai/openai-java'
automatic_release:
name: Release / create
if: >-
github.event_name != 'workflow_dispatch' &&
github.ref == 'refs/heads/main' &&
github.repository == 'openai/openai-java'
permissions:
contents: write
issues: write
pull-requests: write
runs-on: ubuntu-24.04
timeout-minutes: 15
environment: publish
outputs:
should_publish: >-
${{ github.event_name == 'workflow_dispatch' ||
steps.automatic.outputs.releases_created == 'true' }}
source_sha: ${{ steps.retry.outputs.source_sha || steps.automatic.outputs.sha }}
release_tag: ${{ steps.retry.outputs.release_tag || steps.automatic.outputs.tag_name }}
releases_created: ${{ steps.release.outputs.releases_created }}
source_sha: ${{ steps.release.outputs.sha }}
release_tag: ${{ steps.release.outputs.tag_name }}

steps:
- name: Check out main
if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false

- name: Create release
if: github.event_name != 'workflow_dispatch'
id: automatic
uses: stainless-api/trigger-release-please@bb6677c5a04578eec1ccfd9e1913b5b78ed64c61 # v1.4.0
id: release
uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
with:
repo: ${{ github.event.repository.full_name }}
stainless-api-key: ${{ secrets.STAINLESS_API_KEY }}
token: ${{ secrets.GITHUB_TOKEN }}
Comment thread
jbeckwith-oai marked this conversation as resolved.
Comment thread
jbeckwith-oai marked this conversation as resolved.
target-branch: main
Comment thread
jbeckwith-oai marked this conversation as resolved.
config-file: release-please-config.json
manifest-file: .release-please-manifest.json

retry_release:
name: Release / select retry source
if: >-
github.event_name == 'workflow_dispatch' &&
github.ref == 'refs/heads/main' &&
github.repository == 'openai/openai-java'
permissions:
contents: read
runs-on: ubuntu-24.04
timeout-minutes: 15
outputs:
source_sha: ${{ steps.retry.outputs.source_sha }}
release_tag: ${{ steps.retry.outputs.release_tag }}

steps:
- name: Validate retry request
if: github.event_name == 'workflow_dispatch'
env:
RELEASE_TAG: ${{ inputs.release_tag }}
CONFIRMED: ${{ inputs.confirm_no_pending_deployment }}
Expand All @@ -75,18 +87,16 @@ jobs:
fi

- name: Check out retry source
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
fetch-depth: 0
ref: refs/tags/${{ inputs.release_tag }}

- name: Verify retry source
if: github.event_name == 'workflow_dispatch'
id: retry
env:
GH_TOKEN: ${{ github.token }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: ${{ inputs.release_tag }}
run: |
set -euo pipefail
Expand Down Expand Up @@ -123,10 +133,39 @@ jobs:
echo "release_tag=$RELEASE_TAG"
} >> "$GITHUB_OUTPUT"

release:
name: Release / select source
needs:
- automatic_release
- retry_release
if: >-
always() &&
(needs.automatic_release.result == 'success' ||
needs.retry_release.result == 'success')
permissions: {}
runs-on: ubuntu-24.04
timeout-minutes: 1
outputs:
should_publish: >-
${{ needs.retry_release.result == 'success' ||
needs.automatic_release.outputs.releases_created == 'true' }}
source_sha: >-
${{ needs.retry_release.outputs.source_sha ||
needs.automatic_release.outputs.source_sha }}
release_tag: >-
${{ needs.retry_release.outputs.release_tag ||
needs.automatic_release.outputs.release_tag }}

steps:
- name: Select release source
run: echo "Release source selected"

runtime_compatibility:
name: Release / runtime compatibility
needs: release
if: needs.release.outputs.should_publish == 'true'
permissions:
contents: read
uses: ./.github/workflows/runtime-compatibility.yml
with:
ref: ${{ needs.release.outputs.source_sha }}
Expand All @@ -139,6 +178,8 @@ jobs:
if: >-
needs.release.outputs.should_publish == 'true' &&
needs.runtime_compatibility.result == 'success'
permissions:
contents: read
runs-on: ubuntu-24.04
timeout-minutes: 90
environment: publish
Expand Down
7 changes: 2 additions & 5 deletions release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@
"packages": {
".": {}
},
"$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json",
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/v17.6.0/schemas/config.json",
"include-v-in-tag": true,
"include-component-in-tag": false,
"versioning": "prerelease",
"prerelease": true,
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": false,
"pull-request-header": "Automated Release PR",
"pull-request-title-pattern": "release: ${version}",
"changelog-sections": [
Expand Down Expand Up @@ -61,6 +57,7 @@
],
"release-type": "simple",
"extra-files": [
"CONTRIBUTING.md",
"README.md",
"bedrock.md",
"build.gradle.kts"
Expand Down
Loading