Skip to content

Commit 5d34e43

Browse files
committed
Change to UV (and minor improvements)
1 parent edffc54 commit 5d34e43

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

.github/workflows/verify.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,32 @@ jobs:
3333
steps:
3434
- name: Check out committed code
3535
uses: actions/checkout@v4
36+
- name: Check for existing package on TestPyPI
37+
id: check_package
38+
run: |
39+
PACKAGE_VERSION=$(python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])")
40+
PACKAGE_NAME=$(python -c "import toml; print(toml.load('pyproject.toml')['project']['name'])")
41+
42+
echo "Checking for package: $PACKAGE_NAME==$PACKAGE_VERSION"
43+
if curl -sI "https://test.pypi.org/project/$PACKAGE_NAME/$PACKAGE_VERSION/" | head -n 1 | grep "HTTP/1.1 200 OK"; then
44+
echo "Package version already exists. Skipping upload."
45+
echo "::set-output name=should_publish::false"
46+
else
47+
echo "Package version does not exist. Proceeding with upload."
48+
echo "::set-output name=should_publish::true"
49+
fi
3650
- name: Prepare uv
51+
if: steps.check_package.outputs.should_publish == 'true'
3752
run: |
3853
pip install uv
3954
uv venv --seed venv
4055
- name: Build
56+
if: steps.check_package.outputs.should_publish == 'true'
4157
run: |
4258
. venv/bin/activate
4359
uv build
4460
- name: Publish distribution 📦 to TestPyPI
61+
if: steps.check_package.outputs.should_publish == 'true'
4562
run: |
4663
. venv/bin/activate
4764
uv publish --publish-url https://test.pypi.org/legacy/

0 commit comments

Comments
 (0)