openai-agents-python/.github/workflows/publish.yml
Kazuhiro Sera 91fb508a89
ci: run PyPI publish checks once on Python 3.14 (#6070)
Run PyPI publish checks once on Python 3.14
2026-11-18 17:55:00 +00:00

175 lines
5.8 KiB
YAML

name: Publish to PyPI
on:
release:
types:
- published
permissions: {}
concurrency:
group: pypi-${{ github.event.release.tag_name }}
cancel-in-progress: false
jobs:
checks:
permissions:
contents: read
pull-requests: read
runs-on: ubuntu-latest
steps:
# Tag rules and environment protection remain the release authorization boundary.
- name: Checkout release validator from main
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: refs/heads/main
path: control
persist-credentials: false
sparse-checkout: .github/scripts
- name: Checkout release commit
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: ${{ github.sha }}
path: release-source
fetch-depth: 0
persist-credentials: false
- name: Setup Python for release validation
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0
with:
python-version: "3.14"
- name: Validate release provenance
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
RELEASE_SHA: ${{ github.sha }}
run: >-
python -I control/.github/scripts/verify_release.py
--repo release-source --tag "$RELEASE_TAG" --expected-sha "$RELEASE_SHA"
- name: Verify human-reviewed release candidate
if: vars.RELEASE_AUTOMATION_ENABLED == 'true'
env:
GH_TOKEN: ${{ github.token }}
RELEASE_SHA: ${{ github.sha }}
run: python -I control/.github/scripts/release_automation.py verify-publication
- name: Setup uv
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # setup-uv v9.0.0; uv 0.11.14
with:
version: "0.11.14"
enable-cache: false
python-version: "3.14"
- name: Check release source
working-directory: release-source
shell: bash
env:
OPENAI_API_KEY: fake-for-tests
UV_LOCKED: "1"
run: |
make sync tests
make typecheck
build:
# Test processes and filesystem mutations stay on the checks runner.
needs: checks
permissions:
contents: read
runs-on: ubuntu-latest
outputs:
artifact-id: ${{ steps.upload.outputs.artifact-id }}
steps:
# Tag rules and environment protection remain the release authorization boundary.
- name: Checkout release validator from main
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: refs/heads/main
path: control
persist-credentials: false
sparse-checkout: .github/scripts
- name: Checkout release commit
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: ${{ github.sha }}
path: release-source
fetch-depth: 0
persist-credentials: false
- name: Setup Python for release validation
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0
with:
python-version: "3.14"
- name: Validate release provenance
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
RELEASE_SHA: ${{ github.sha }}
run: >-
python -I control/.github/scripts/verify_release.py
--repo release-source --tag "$RELEASE_TAG" --expected-sha "$RELEASE_SHA"
- name: Setup uv
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # setup-uv v9.0.0; uv 0.11.14
with:
version: "0.11.14"
enable-cache: false
python-version: "3.14"
- name: Build package
working-directory: release-source
run: uv build
- name: Store distributions
id: upload
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: python-distributions-${{ github.run_attempt }}
path: release-source/dist/
if-no-files-found: error
retention-days: 7
publish:
needs: build
environment:
name: pypi
url: https://pypi.org/p/openai-agents
permissions:
id-token: write
contents: read
pull-requests: read
runs-on: ubuntu-latest
steps:
- name: Download distributions
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333
with:
artifact-ids: ${{ needs.build.outputs.artifact-id }}
path: dist/
merge-multiple: true
- name: Checkout approval validator from main
if: vars.RELEASE_AUTOMATION_ENABLED == 'true'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: refs/heads/main
path: control
persist-credentials: false
sparse-checkout: .github/scripts
- name: Revalidate human approval before upload
if: vars.RELEASE_AUTOMATION_ENABLED == 'true'
env:
GH_TOKEN: ${{ github.token }}
RELEASE_SHA: ${{ github.sha }}
run: python3 -I control/.github/scripts/release_automation.py verify-publication
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33
release-notes:
needs: checks
if: vars.RELEASE_AUTOMATION_ENABLED == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: refs/heads/main
persist-credentials: false
sparse-checkout: .github/scripts
- name: Append reviewed highlights and release assessment
env:
GH_TOKEN: ${{ github.token }}
RELEASE_SHA: ${{ github.sha }}
run: python -I .github/scripts/release_automation.py publish-notes