-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·120 lines (102 loc) · 2.94 KB
/
Copy pathdeploy.sh
File metadata and controls
executable file
·120 lines (102 loc) · 2.94 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
#!/bin/bash
# Deployment script for xcode-mcp-server
# This script builds and publishes the package to PyPI
# If you want to deploy a BETA, this script won't do it,
# but you can do it manually:
#
# You can use pre-release version numbers following
# https://peps.python.org/pep-0440/. PyPI will accept them, but pip won't
# install them by default.
#
# Pre-release version formats:
# - 1.2.3b1 - beta 1
# - 1.2.3a1 - alpha 1
# - 1.2.3rc1 - release candidate 1
#
# To publish a beta:
# python -m hatch version 1.2.3b1 # Set beta version
# python -m build
# python -m twine upload dist/*
#
# Users can install it with:
# # Specific beta version (safest for testers)
# pip install xcode-mcp-server==1.2.3b1
# uvx xcode-mcp-server==1.2.3b1
#
# Regular users doing pip install xcode-mcp-server will get the latest
# stable version and skip all pre-releases automatically.
set -e # Exit on error
echo "🚀 Starting xcode-mcp-server deployment..."
echo ""
# Pre-flight: ensure no unstaged changes
UNSTAGED=$(git diff --name-only)
if [ -n "$UNSTAGED" ]; then
echo "❌ You have unstaged changes:"
git diff --stat
echo ""
echo "Please stage ('git add') or commit your changes before deploying."
exit 1
fi
echo "✅ No unstaged changes"
echo ""
/bin/echo -n "Hit enter to continue:"
read foo
# Set up venv and install deploy dependencies
source "$(dirname "${BASH_SOURCE[0]}")/_venv-setup.sh"
pip install -q hatch build twine
echo ""
# Create dist-archive directory if it doesn't exist
mkdir -p dist-archive
# Archive any existing dist files
if [ -d "dist" ] && [ "$(ls -A dist 2>/dev/null)" ]; then
echo "📦 Archiving previous dist files..."
mv dist/* dist-archive/
echo ""
fi
# Clean dist directory
echo "🧹 Cleaning dist directory..."
rm -rf dist
mkdir -p dist
echo ""
# Increment version
echo "📝 Incrementing patch version..."
hatch version patch
NEW_VERSION=$(hatch version)
echo ""
# Build the package
echo "🔨 Building package..."
python -m build
echo ""
# Copy new build to archive
echo "💾 Copying new build to archive..."
cp dist/* dist-archive/
echo ""
# Upload to PyPI
echo "📤 Uploading to PyPI..."
twine upload dist/*
echo ""
# Verify on PyPI
echo "🔍 Verifying version $NEW_VERSION on PyPI..."
sleep 2
if curl -sf "https://pypi.org/pypi/xcode-mcp-server/$NEW_VERSION/json" > /dev/null 2>&1; then
echo "✅ Version $NEW_VERSION confirmed on PyPI"
else
echo "⚠️ Could not verify version $NEW_VERSION on PyPI."
echo "Skipping auto-commit. Please verify manually and commit the version change."
exit 1
fi
echo ""
# Commit and push the version bump
echo "📝 Committing version bump..."
git add xcode_mcp_server/__init__.py
git add dist
git add dist-archive
git commit -m "v$NEW_VERSION"
git push
echo ""
echo "✅ Deployment complete! v$NEW_VERSION is live."
echo ""
echo "Test the deployed version with:"
echo ""
echo " uvx xcode-mcp-server"
exit 0