diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 522fde7f..c00ee504 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -7,6 +7,11 @@ on: release: types: [published] workflow_dispatch: + inputs: + package_version: + description: Version to build for this run (blank uses pyproject.toml) + type: string + required: false permissions: contents: read @@ -33,6 +38,12 @@ jobs: version: '0.9.22' python-version: '3.11' + - name: Apply the requested build version + if: github.event_name == 'workflow_dispatch' && inputs.package_version != '' + env: + PACKAGE_VERSION: ${{ inputs.package_version }} + run: uv version --frozen -- "$PACKAGE_VERSION" + - name: Build the wheel and source distribution run: | export SOURCE_DATE_EPOCH=$(git show -s --format=%ct HEAD) @@ -41,7 +52,10 @@ jobs: - name: Validate distributions and release version id: check env: - RELEASE_TAG: ${{ github.ref_type == 'tag' && github.ref_name || '' }} + RELEASE_TAG: >- + ${{ github.ref_type == 'tag' && + (github.event_name != 'workflow_dispatch' || inputs.package_version == '') && + github.ref_name || '' }} PUBLISH_TO_PYPI: ${{ github.repository == 'oceanbase/pyseekdb' && github.event_name != 'workflow_dispatch' }} run: | uv run --no-project --with twine python -m twine check --strict dist/*.whl dist/*.tar.gz diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 23b13330..6954222b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -61,8 +61,9 @@ After running `make build`, the distribution files will be in the `dist/` direct Set `project.version` in `pyproject.toml` on the commit you want to release. Run **Publish pyseekdb to PyPI** manually in Actions to build and check the -distributions. Push a matching tag such as `v1.4.1` or publish its GitHub Release -to upload the wheel and source distribution to PyPI. +distributions. Set `package_version` to choose the version for that run, or +leave it blank to use `project.version`. Push a matching tag such as `v1.4.1` +or publish its GitHub Release to upload the wheel and source distribution to PyPI. Configure [Trusted Publishing](https://docs.pypi.org/trusted-publishers/adding-a-publisher/) in the PyPI `pyseekdb` project with owner `oceanbase`, repository `pyseekdb`, diff --git a/pyproject.toml b/pyproject.toml index 7c6e6a5d..bfd18e07 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "pyseekdb" -version = "1.2.0.dev1" +version = "1.4.1" description = "A unified Python client for seekdb that supports embedded, server, and OceanBase." readme = "README.md" license = "Apache-2.0" diff --git a/uv.lock b/uv.lock index 8310bbb6..ad34a04d 100644 --- a/uv.lock +++ b/uv.lock @@ -2261,7 +2261,7 @@ wheels = [ [[package]] name = "pyseekdb" -version = "1.2.0.dev1" +version = "1.4.1" source = { editable = "." } dependencies = [ { name = "httpx" },