Skip to content

Commit c25fcdc

Browse files
committed
[skip ci] update publish workflow
1 parent 5b03d91 commit c25fcdc

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,27 @@ jobs:
2626

2727
- name: Verify version matches tag
2828
run: |
29+
# Check if this is a tag-triggered run
30+
if [[ "$GITHUB_REF" != refs/tags/v* ]]; then
31+
echo "============================================================"
32+
echo "ERROR: This workflow must be triggered from a version tag"
33+
echo "============================================================"
34+
echo ""
35+
echo "Current ref: $GITHUB_REF"
36+
echo ""
37+
echo "How to fix:"
38+
echo " Option 1: Push a tag to trigger automatically"
39+
echo " git tag v0.X.X"
40+
echo " git push origin v0.X.X"
41+
echo ""
42+
echo " Option 2: Use workflow_dispatch from a tag"
43+
echo " 1. Go to Actions → 'Release to PyPI' → 'Run workflow'"
44+
echo " 2. In 'Use workflow from' dropdown, select the TAG (e.g., v0.2.0)"
45+
echo " NOT a branch like 'main'"
46+
echo " 3. Click 'Run workflow'"
47+
echo "============================================================"
48+
exit 1
49+
fi
2950
TAG_VERSION=${GITHUB_REF#refs/tags/v}
3051
PYPROJECT_VERSION=$(uv run python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
3152

0 commit comments

Comments
 (0)