forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·124 lines (103 loc) · 3.26 KB
/
Copy pathrelease.sh
File metadata and controls
executable file
·124 lines (103 loc) · 3.26 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/bash
# omi-cli release script
# Builds the omi-cli package and (optionally) uploads to PyPI.
#
# Usage:
# ./release.sh # interactive: build, twine check, prompt before upload
# ./release.sh --build-only # build + twine check only, no upload, no tag prompt
#
# Tag scheme: omi-cli-vX.Y.Z (does NOT collide with the omi-sdk's vX.Y.Z scheme).
set -e
BUILD_ONLY=0
for arg in "$@"; do
case "$arg" in
--build-only)
BUILD_ONLY=1
;;
-h|--help)
grep '^#' "$0" | sed 's/^# \{0,1\}//'
exit 0
;;
*)
echo "❌ Unknown argument: $arg"
exit 1
;;
esac
done
echo "🚀 Starting omi-cli release process..."
if [ ! -f "pyproject.toml" ]; then
echo "❌ Error: pyproject.toml not found. Run from sdks/python-cli/."
exit 1
fi
if ! command -v python &> /dev/null; then
echo "❌ Error: python not found"
exit 1
fi
if ! python -m pip show build &> /dev/null; then
echo "📦 Installing build tools..."
python -m pip install --quiet build twine
fi
CURRENT_VERSION=$(python -c "
import omi_cli
print(omi_cli.__version__)
")
echo "📋 Current version: ${CURRENT_VERSION}"
echo "🔍 Checking if version exists on PyPI..."
if pip index versions omi-cli 2>/dev/null | grep -q "${CURRENT_VERSION}"; then
echo "❌ Error: Version ${CURRENT_VERSION} already exists on PyPI."
echo "💡 Bump omi_cli.__version__ first."
exit 1
fi
if ! git diff-index --quiet HEAD --; then
echo "⚠️ Warning: uncommitted changes present."
if [ "$BUILD_ONLY" -eq 0 ]; then
read -p "🤔 Continue anyway? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "❌ Release cancelled."
exit 1
fi
fi
fi
CURRENT_BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
echo "🌿 Branch: ${CURRENT_BRANCH}"
echo "🧹 Cleaning previous builds..."
rm -rf dist/ build/ *.egg-info/
echo "📦 Building package..."
python -m build
echo "🔍 Verifying package metadata..."
python -m twine check dist/*
echo "📋 Built artifacts:"
ls -la dist/
echo
echo "🎯 Release Summary"
echo " Package: omi-cli"
echo " Version: ${CURRENT_VERSION}"
echo " Branch: ${CURRENT_BRANCH}"
echo
if [ "$BUILD_ONLY" -eq 1 ]; then
echo "✅ Build complete (build-only mode — no upload, no tag)."
echo "💡 To upload manually: python -m twine upload dist/*"
echo "💡 To tag: git tag omi-cli-v${CURRENT_VERSION}"
exit 0
fi
read -p "🤔 Upload to PyPI? (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "⬆️ Uploading to PyPI..."
python -m twine upload dist/*
echo "✅ Uploaded."
read -p "🏷️ Create git tag omi-cli-v${CURRENT_VERSION}? (Y/n): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Nn]$ ]]; then
git tag "omi-cli-v${CURRENT_VERSION}"
echo "✅ Tag created locally. Push with: git push origin omi-cli-v${CURRENT_VERSION}"
fi
echo "🎉 omi-cli v${CURRENT_VERSION} released!"
echo "📦 https://pypi.org/project/omi-cli/${CURRENT_VERSION}/"
else
echo "❌ Upload cancelled."
echo "💡 To upload later: python -m twine upload dist/*"
fi
echo "🧹 Cleaning intermediate build dirs..."
rm -rf build/ *.egg-info/