From 95af42b957a32f32b71d76ec148a5d5a2f6d06ce Mon Sep 17 00:00:00 2001 From: Joel Dierkes Date: Mon, 14 Sep 2026 11:23:59 +0200 Subject: [PATCH] ci: release from the monorepo mirror The code in this repository is generated in Mixedbread's monorepo and mirrored here as one commit per change; a new version arrives with a tag and a GitHub release. CI now lints, type-checks and builds; the publish workflow runs on a published release through trusted publishing (or the PYPI_TOKEN secret) and no longer depends on release-please. --- .github/CONTRIBUTING.md | 18 +++++ .github/workflows/ci.yml | 115 +++++---------------------- .github/workflows/publish-pypi.yml | 37 +++++---- .github/workflows/release-doctor.yml | 21 ----- .release-please-manifest.json | 3 - release-please-config.json | 66 --------------- 6 files changed, 58 insertions(+), 202 deletions(-) create mode 100644 .github/CONTRIBUTING.md delete mode 100644 .github/workflows/release-doctor.yml delete mode 100644 .release-please-manifest.json delete mode 100644 release-please-config.json diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 00000000..d12c0ed5 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,18 @@ +# Contributing + +This repository holds the source of `mixedbread on PyPI`. The code is generated from Mixedbread's OpenAPI +specification inside our monorepo and mirrored here on every change, one commit per monorepo +commit; a GitHub release is created whenever the version changes, and the workflow in this +repository publishes it. + +Because of that, pull requests against this repository cannot be merged: the next mirror would +overwrite them. Instead: + +- **Bugs and feature requests**: open an issue here. We port the change into the monorepo, and it + shows up here with the next mirror. +- **Hand-written helpers** (under `src/mixedbread/lib/`): also welcome as an issue or a PR that we use as a + reference while porting. + +Every mirrored commit has passed the monorepo's checks: generator tests, freshness of the +generated code against the specification, lint, type checks and the test suite against a mock +server. The `CI` workflow here repeats lint, type checks and the build. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b06d834..d24d463b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,104 +1,33 @@ name: CI + +# Lints, type-checks and builds the package. The code in this repository is generated from +# Mixedbread's monorepo, whose CI also runs the test suite against a mock server before a +# change reaches main here. + on: push: - branches: - - '**' - - '!integrated/**' - - '!stl-preview-head/**' - - '!stl-preview-base/**' - - '!generated' - - '!codegen/**' - - 'codegen/stl/**' + branches: [main] pull_request: - branches-ignore: - - 'stl-preview-head/**' - - 'stl-preview-base/**' jobs: lint: - timeout-minutes: 10 - name: lint - runs-on: ${{ github.repository == 'stainless-sdks/mixedbread-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} - if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') + name: lint and build + runs-on: ubuntu-latest + timeout-minutes: 15 steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - - name: Install Rye - run: | - curl -sSf https://rye.astral.sh/get | bash - echo "$HOME/.rye/shims" >> $GITHUB_PATH - env: - RYE_VERSION: '0.44.0' - RYE_INSTALL_OPTION: '--yes' - + - uses: actions/checkout@v5 + - uses: astral-sh/setup-uv@v7 + with: + version: "0.8.16" - name: Install dependencies - run: rye sync --all-features - - - name: Run lints - run: ./scripts/lint - - build: - if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') - timeout-minutes: 10 - name: build - permissions: - contents: read - id-token: write - runs-on: ${{ github.repository == 'stainless-sdks/mixedbread-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - - name: Install Rye + run: uv sync --locked --group dev --all-extras + - name: Lint run: | - curl -sSf https://rye.astral.sh/get | bash - echo "$HOME/.rye/shims" >> $GITHUB_PATH - env: - RYE_VERSION: '0.44.0' - RYE_INSTALL_OPTION: '--yes' - - - name: Install dependencies - run: rye sync --all-features - - - name: Run build - run: rye build - - - name: Get GitHub OIDC Token - if: |- - github.repository == 'stainless-sdks/mixedbread-python' && - !startsWith(github.ref, 'refs/heads/stl/') - id: github-oidc - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 - with: - script: core.setOutput('github_token', await core.getIDToken()); - - - name: Upload tarball - if: |- - github.repository == 'stainless-sdks/mixedbread-python' && - !startsWith(github.ref, 'refs/heads/stl/') - env: - URL: https://pkg.stainless.com/s - AUTH: ${{ steps.github-oidc.outputs.github_token }} - SHA: ${{ github.sha }} - run: ./scripts/utils/upload-artifact.sh - - test: - timeout-minutes: 10 - name: test - runs-on: ${{ github.repository == 'stainless-sdks/mixedbread-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} - if: github.event_name == 'push' || github.event.pull_request.head.repo.fork - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - - name: Install Rye + uv run ruff check . + uv run ruff format --check . + - name: Type-check run: | - curl -sSf https://rye.astral.sh/get | bash - echo "$HOME/.rye/shims" >> $GITHUB_PATH - env: - RYE_VERSION: '0.44.0' - RYE_INSTALL_OPTION: '--yes' - - - name: Bootstrap - run: ./scripts/bootstrap - - - name: Run tests - run: ./scripts/test + uv run pyright + uv run mypy . + - name: Build + run: uv build diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 9343729a..9559d9f7 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -1,10 +1,11 @@ -# This workflow is triggered when a GitHub release is created. -# It can also be run manually to re-publish to PyPI in case it failed for some reason. -# You can run this workflow by navigating to https://www.github.com/mixedbread-ai/mixedbread-python/actions/workflows/publish-pypi.yml name: Publish PyPI + +# Runs when a GitHub release is published (the monorepo creates one per new version) and can be +# re-run manually if a publish failed. Publishes through PyPI trusted publishing; set the +# PYPI_TOKEN secret to publish with an API token instead. + on: workflow_dispatch: - release: types: [published] @@ -12,20 +13,18 @@ jobs: publish: name: publish runs-on: ubuntu-latest - + environment: pypi + permissions: + contents: read + id-token: write steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - - name: Install Rye - run: | - curl -sSf https://rye.astral.sh/get | bash - echo "$HOME/.rye/shims" >> $GITHUB_PATH - env: - RYE_VERSION: '0.44.0' - RYE_INSTALL_OPTION: '--yes' - + - uses: actions/checkout@v5 + - uses: astral-sh/setup-uv@v7 + with: + version: "0.8.16" + - name: Build + run: uv build - name: Publish to PyPI - run: | - bash ./bin/publish-pypi - env: - PYPI_TOKEN: ${{ secrets.MIXEDBREAD_PYPI_TOKEN || secrets.PYPI_TOKEN }} + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_TOKEN }} diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml deleted file mode 100644 index 133836a8..00000000 --- a/.github/workflows/release-doctor.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Release Doctor -on: - pull_request: - branches: - - main - workflow_dispatch: - -jobs: - release_doctor: - name: release doctor - runs-on: ubuntu-latest - if: github.repository == 'mixedbread-ai/mixedbread-python' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') - - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - - name: Check release environment - run: | - bash ./bin/check-release-environment - env: - PYPI_TOKEN: ${{ secrets.MIXEDBREAD_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.release-please-manifest.json b/.release-please-manifest.json deleted file mode 100644 index d940b600..00000000 --- a/.release-please-manifest.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - ".": "0.55.0" -} \ No newline at end of file diff --git a/release-please-config.json b/release-please-config.json deleted file mode 100644 index 0e2bc44e..00000000 --- a/release-please-config.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "packages": { - ".": {} - }, - "$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/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": [ - { - "type": "feat", - "section": "Features" - }, - { - "type": "fix", - "section": "Bug Fixes" - }, - { - "type": "perf", - "section": "Performance Improvements" - }, - { - "type": "revert", - "section": "Reverts" - }, - { - "type": "chore", - "section": "Chores" - }, - { - "type": "docs", - "section": "Documentation" - }, - { - "type": "style", - "section": "Styles" - }, - { - "type": "refactor", - "section": "Refactors" - }, - { - "type": "test", - "section": "Tests", - "hidden": true - }, - { - "type": "build", - "section": "Build System" - }, - { - "type": "ci", - "section": "Continuous Integration", - "hidden": true - } - ], - "release-type": "python", - "extra-files": [ - "src/mixedbread/_version.py" - ] -} \ No newline at end of file