Skip to content

Personal AI, On Personal Devices

Python

fix: keep prerelease builds off production PyPI (#1010)

Elliot Sluskyf5506be9beca
diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml
index b08fba0a..5129e60e 100644
--- a/.github/workflows/pypi-publish.yml
+++ b/.github/workflows/pypi-publish.yml
@@ -78,6 +78,7 @@ jobs:
}
- name: Resolve build version from tag
+ id: version
env:
REF: ${{ steps.ref.outputs.ref }}
run: |
@@ -93,6 +94,13 @@ jobs:
# `.devN` tags, so we pin the exact build version explicitly — the
# published version always equals the pushed tag.
echo "SETUPTOOLS_SCM_PRETEND_VERSION=${VERSION}" >> "$GITHUB_ENV"
+ if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
+ echo "prerelease=false" >> "$GITHUB_OUTPUT"
+ echo "Release channel: production PyPI"
+ else
+ echo "prerelease=true" >> "$GITHUB_OUTPUT"
+ echo "Release channel: TestPyPI"
+ fi
echo "Building version ${VERSION}"
- name: Build package
@@ -129,7 +137,7 @@ jobs:
uvx twine check --strict dist/*
- name: Publish to TestPyPI (dry run)
- if: ${{ inputs.dry_run }}
+ if: ${{ inputs.dry_run || steps.version.outputs.prerelease == 'true' }}
env:
UV_PUBLISH_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }}
run: |
@@ -143,5 +151,5 @@ jobs:
uv publish --publish-url https://test.pypi.org/legacy/
- name: Publish to PyPI
- if: ${{ !inputs.dry_run }}
+ if: ${{ !inputs.dry_run && steps.version.outputs.prerelease == 'false' }}
run: uv publish