11name : Publish to PyPI
22
33on :
4+ release :
5+ types : [published]
46 workflow_dispatch :
7+ inputs :
8+ tag :
9+ description : " Release tag (e.g. v1.2.3 or reflex-lucide-v0.1.0)"
10+ required : true
511
612jobs :
713 publish :
@@ -18,10 +24,42 @@ jobs:
1824 - name : Install uv
1925 uses : astral-sh/setup-uv@v7
2026
27+ - name : Parse release tag
28+ id : parse
29+ run : |
30+ TAG="${{ github.event.release.tag_name || inputs.tag }}"
31+ # Tag format: v1.2.3 for reflex, reflex-lucide-v0.1.0 for sub-packages
32+ if [[ "$TAG" =~ ^v([0-9].*)$ ]]; then
33+ echo "package=reflex" >> "$GITHUB_OUTPUT"
34+ echo "version=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT"
35+ echo "build_dir=." >> "$GITHUB_OUTPUT"
36+ elif [[ "$TAG" =~ ^(.+)-v([0-9].*)$ ]]; then
37+ PACKAGE="${BASH_REMATCH[1]}"
38+ VERSION="${BASH_REMATCH[2]}"
39+ if [ ! -d "packages/$PACKAGE" ]; then
40+ echo "Error: packages/$PACKAGE does not exist"
41+ exit 1
42+ fi
43+ echo "package=$PACKAGE" >> "$GITHUB_OUTPUT"
44+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
45+ echo "build_dir=packages/$PACKAGE" >> "$GITHUB_OUTPUT"
46+ else
47+ echo "Error: Tag '$TAG' does not match expected format (v* or <package>-v*)"
48+ exit 1
49+ fi
50+
51+ - name : Set version
52+ run : |
53+ cd "${{ steps.parse.outputs.build_dir }}"
54+ sed -i 's/^version = ".*"/version = "${{ steps.parse.outputs.version }}"/' pyproject.toml
55+ echo "Building ${{ steps.parse.outputs.package }} v${{ steps.parse.outputs.version }}"
56+ grep '^version' pyproject.toml
57+
2158 - name : Build
22- run : uv build
59+ run : uv build --directory "${{ steps.parse.outputs.build_dir }}"
2360
2461 - name : Verify .pyi files in wheel
62+ if : steps.parse.outputs.package == 'reflex'
2563 run : |
2664 if unzip -l dist/*.whl | grep '\.pyi$'; then
2765 echo "✓ .pyi files found in distribution"
3169 fi
3270
3371 - name : Publish
34- run : uv publish
72+ run : uv publish --directory "${{ steps.parse.outputs.build_dir }}"
0 commit comments