Skip to content

Commit d3d5bfb

Browse files
authored
make reflex and reflex base tied (#6379)
1 parent 7e79619 commit d3d5bfb

5 files changed

Lines changed: 93 additions & 12 deletions

File tree

.github/scripts/dispatch_release/detect.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
set -euo pipefail
33

44
declare -A MAP=(
5-
[reflex]=reflex
65
[hatch_reflex_pyi]=hatch-reflex-pyi
76
[reflex_base]=reflex-base
87
[reflex_components_code]=reflex-components-code
@@ -20,7 +19,7 @@ declare -A MAP=(
2019
[reflex_docgen]=reflex-docgen
2120
[reflex_hosting_cli]=reflex-hosting-cli
2221
)
23-
ORDER=(reflex hatch_reflex_pyi reflex_base reflex_components_code reflex_components_core reflex_components_dataeditor reflex_components_gridjs reflex_components_lucide reflex_components_markdown reflex_components_moment reflex_components_plotly reflex_components_radix reflex_components_react_player reflex_components_recharts reflex_components_sonner reflex_docgen reflex_hosting_cli)
22+
ORDER=(hatch_reflex_pyi reflex_base reflex_components_code reflex_components_core reflex_components_dataeditor reflex_components_gridjs reflex_components_lucide reflex_components_markdown reflex_components_moment reflex_components_plotly reflex_components_radix reflex_components_react_player reflex_components_recharts reflex_components_sonner reflex_docgen reflex_hosting_cli)
2423

2524
PACKAGES=()
2625
for key in "${ORDER[@]}"; do

.github/scripts/dispatch_release/plan.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,29 @@ def main() -> None:
176176
"tag": tag,
177177
})
178178

179+
# reflex is not independently releasable via dispatch: when reflex-base is
180+
# released, reflex is released alongside it with a matching version. The
181+
# publish workflow pins reflex-base exactly when building reflex.
182+
reflex_base_release = next(
183+
(r for r in releases if r["package"] == "reflex-base"), None
184+
)
185+
if reflex_base_release is not None:
186+
reflex_version = reflex_base_release["next"]
187+
reflex_tag = f"v{reflex_version}"
188+
if tag_exists(reflex_tag):
189+
fail(f"tag {reflex_tag} already exists")
190+
current_reflex = pick_latest("v")
191+
display = current_reflex if current_reflex is not None else "<none>"
192+
summary_rows.append(
193+
f"| `reflex` | `{display}` | `{reflex_version}` | `{reflex_tag}` |"
194+
)
195+
releases.append({
196+
"package": "reflex",
197+
"current": current_reflex or "",
198+
"next": reflex_version,
199+
"tag": reflex_tag,
200+
})
201+
179202
with pathlib.Path(github_step_summary).open("a") as f:
180203
f.write("\n".join(summary_rows) + "\n")
181204
with pathlib.Path(github_output).open("a") as f:

.github/workflows/dispatch_release.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ on:
1111
description: "Release action"
1212
required: true
1313
type: choice
14-
default: new-prerelease-patch
14+
# default is continued-prerelease to prevent accidental releases.
15+
default: continued-prerelease
1516
options:
1617
- new-prerelease-patch
1718
- new-prerelease-minor
@@ -22,10 +23,6 @@ on:
2223
- release-patch
2324
- release-minor
2425
- release-major
25-
reflex:
26-
description: "reflex"
27-
type: boolean
28-
default: false
2926
hatch_reflex_pyi:
3027
description: "hatch-reflex-pyi"
3128
type: boolean
@@ -104,7 +101,6 @@ jobs:
104101
- uses: actions/checkout@v6
105102
- id: detect
106103
env:
107-
reflex: ${{ inputs.reflex }}
108104
hatch_reflex_pyi: ${{ inputs.hatch_reflex_pyi }}
109105
reflex_base: ${{ inputs.reflex_base }}
110106
reflex_components_code: ${{ inputs.reflex_components_code }}

.github/workflows/publish.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: Publish to PyPI
22

3+
run-name: Publish ${{ github.event.release.tag_name || inputs.tag }}
4+
35
on:
46
release:
57
types: [published]
@@ -36,6 +38,7 @@ jobs:
3638
if [[ "$TAG" =~ ^v([0-9].*)$ ]]; then
3739
echo "package=reflex" >> "$GITHUB_OUTPUT"
3840
echo "build_dir=." >> "$GITHUB_OUTPUT"
41+
echo "version=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT"
3942
elif [[ "$TAG" =~ ^(.+)-v([0-9].*)$ ]]; then
4043
PACKAGE="${BASH_REMATCH[1]}"
4144
if [ ! -d "packages/$PACKAGE" ]; then
@@ -44,11 +47,23 @@ jobs:
4447
fi
4548
echo "package=$PACKAGE" >> "$GITHUB_OUTPUT"
4649
echo "build_dir=packages/$PACKAGE" >> "$GITHUB_OUTPUT"
50+
echo "version=${BASH_REMATCH[2]}" >> "$GITHUB_OUTPUT"
4751
else
4852
echo "Error: Tag '$TAG' does not match expected format (v* or <package>-v*)"
4953
exit 1
5054
fi
5155
56+
- name: Pin reflex-base to exact version
57+
if: steps.parse.outputs.package == 'reflex'
58+
run: |
59+
VERSION="${{ steps.parse.outputs.version }}"
60+
if ! grep -q '"reflex-base >= ' pyproject.toml; then
61+
echo "Error: expected 'reflex-base >= ...' dependency in pyproject.toml"
62+
exit 1
63+
fi
64+
sed -i 's|"reflex-base >= [^"]*"|"reflex-base == '"$VERSION"'"|' pyproject.toml
65+
grep '"reflex-base' pyproject.toml
66+
5267
- name: Build
5368
run: uv build --directory "${{ steps.parse.outputs.build_dir }}"
5469

uv.lock

Lines changed: 52 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)