-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpublish.sh
More file actions
executable file
·56 lines (47 loc) · 1.42 KB
/
publish.sh
File metadata and controls
executable file
·56 lines (47 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# NuoYi - Build and upload to PyPI
# Usage: ./publish.sh [test|prod]
set -e
TARGET="${1:-test}"
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR"
echo "=== NuoYi PyPI Publisher ==="
# Read version from __init__.py
VERSION=$(grep -oP '__version__\s*=\s*"\K[^"]+' src/nuoyi/__init__.py)
echo "Version: $VERSION"
# Step 1: Clean old builds
echo ""
echo "[1/4] Cleaning old builds..."
rm -rf dist/ build/ src/*.egg-info
# Step 2: Install build tools
echo "[2/4] Checking build tools..."
python -m pip install --quiet build twine
# Step 3: Build
echo "[3/4] Building sdist and wheel..."
python -m build
echo ""
echo "Built files:"
ls -lh dist/
# Step 4: Upload
echo ""
if [ "$TARGET" = "prod" ]; then
echo "[4/4] Uploading to PyPI (production)..."
echo "WARNING: This will publish to the real PyPI!"
read -p "Continue? [y/N] " confirm
if [ "$confirm" = "y" ] || [ "$confirm" = "Y" ]; then
python -m twine upload dist/*
echo ""
echo "Done! Install with: pip install nuoyi==$VERSION"
else
echo "Cancelled."
fi
elif [ "$TARGET" = "test" ]; then
echo "[4/4] Uploading to TestPyPI..."
python -m twine upload --repository testpypi dist/*
echo ""
echo "Done! Test install with:"
echo " pip install -i https://test.pypi.org/simple/ nuoyi==$VERSION"
else
echo "[4/4] Skipping upload (unknown target: $TARGET)"
echo "Usage: ./publish.sh [test|prod]"
fi