Skip to content

Commit 64b16a6

Browse files
committed
bugfix(chore): publish yml
1 parent e88511b commit 64b16a6

1 file changed

Lines changed: 14 additions & 22 deletions

File tree

.github/workflows/publish-to-pypi.yml

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
default: false
1313
type: boolean
1414
version:
15-
description: 'Version to publish (e.g., 0.1.0) - required for manual testing'
15+
description: 'Version to publish (e.g., 0.1.0)'
1616
required: true
1717
type: string
1818

@@ -21,6 +21,7 @@ jobs:
2121
runs-on: ubuntu-latest
2222
permissions:
2323
contents: write
24+
actions: write
2425

2526
steps:
2627
- name: Checkout repository
@@ -34,9 +35,6 @@ jobs:
3435
- name: Install uv
3536
run: pip install uv
3637

37-
- name: Setup virtual environment
38-
run: uv venv .venv --python=3.10
39-
4038
- name: Extract version
4139
run: |
4240
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
@@ -45,11 +43,6 @@ jobs:
4543
VERSION=$(echo $GITHUB_REF | sed -n 's/refs\/tags\/v//p')
4644
fi
4745
echo "VERSION=$VERSION" >> $GITHUB_ENV
48-
49-
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then
50-
echo "Invalid version format: $VERSION"
51-
exit 1
52-
fi
5346
5447
- name: Update version in pyproject.toml
5548
run: sed -i "s/version = \".*\"/version = \"$VERSION\"/" pyproject.toml
@@ -61,24 +54,23 @@ jobs:
6154
if: github.event_name == 'workflow_dispatch' && inputs.test_only
6255
env:
6356
UV_PUBLISH_TOKEN: ${{ secrets.TEST_PYPI_API_KEY }}
64-
run: uv publish --publish-url https://test.pypi.org/legacy/
57+
run: |
58+
if [ -z "$UV_PUBLISH_TOKEN" ]; then
59+
echo "❌ TEST_PYPI_API_KEY secret not found"
60+
exit 1
61+
fi
62+
uv publish --publish-url https://test.pypi.org/legacy/
6563
66-
- name: Publish to PyPI
64+
- name: Publish to PyPI
6765
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
6866
env:
6967
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_KEY }}
70-
run: uv publish --publish-url https://upload.pypi.org/legacy/
71-
72-
- name: Publish with twine (fallback)
73-
if: failure()
74-
env:
75-
TWINE_USERNAME: __token__
76-
TWINE_PASSWORD: ${{ github.event_name == 'push' && secrets.PYPI_API_KEY || secrets.TEST_PYPI_API_KEY }}
77-
TWINE_REPOSITORY_URL: ${{ github.event_name == 'push' && 'https://upload.pypi.org/legacy/' || 'https://test.pypi.org/legacy/' }}
7868
run: |
79-
source .venv/bin/activate
80-
uv pip install twine
81-
twine upload dist/*
69+
if [ -z "$UV_PUBLISH_TOKEN" ]; then
70+
echo "❌ PYPI_API_KEY secret not found"
71+
exit 1
72+
fi
73+
uv publish --publish-url https://upload.pypi.org/legacy/
8274
8375
- name: Upload built artifacts
8476
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)