-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·94 lines (80 loc) · 2.35 KB
/
deploy.sh
File metadata and controls
executable file
·94 lines (80 loc) · 2.35 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
#!/bin/zsh
# Usage: ./deploy.sh <version>
# Example: ./deploy.sh 2.0.0
#
# NOTE: Before running this, make sure to update release notes in:
# distribution/whatsnew/whatsnew-en-US
VERSION=$1
if [ -z "$VERSION" ]; then
echo "❌ Error: Version is required."
echo "Usage: ./deploy.sh <version>"
echo "Example: ./deploy.sh 2.0.0"
exit 1
fi
echo ""
echo "🎯 Choose deployment track:"
echo " 1) Beta (Open Testing)"
echo " 2) Production"
echo " 3) GitHub Release only"
echo ""
printf "Enter choice (1/2/3): "
read TRACK_CHOICE
if [ "$TRACK_CHOICE" = "1" ]; then
TRACK="beta"
TAG="v$VERSION-beta"
TRACK_LABEL="Open Testing (Beta)"
UPLOAD_PLAY_STORE="true"
UPLOAD_GITHUB_RELEASE="false"
elif [ "$TRACK_CHOICE" = "2" ]; then
TRACK="production"
TAG="v$VERSION"
TRACK_LABEL="Production"
UPLOAD_PLAY_STORE="true"
UPLOAD_GITHUB_RELEASE="false"
elif [ "$TRACK_CHOICE" = "3" ]; then
TRACK="none"
TAG="v$VERSION"
TRACK_LABEL="GitHub Release"
UPLOAD_PLAY_STORE="false"
UPLOAD_GITHUB_RELEASE="true"
else
echo "❌ Invalid choice. Please enter 1, 2, or 3."
exit 1
fi
if [ "$TRACK_CHOICE" = "1" ] || [ "$TRACK_CHOICE" = "2" ]; then
echo ""
printf "📦 Also upload to GitHub Release? (y/n): "
read GITHUB_RELEASE_CHOICE
if [ "$GITHUB_RELEASE_CHOICE" = "y" ] || [ "$GITHUB_RELEASE_CHOICE" = "Y" ]; then
UPLOAD_GITHUB_RELEASE="true"
fi
fi
echo ""
echo "🚀 Tagging $TRACK_LABEL build: $TAG"
# Remove existing local tag if present
if git tag -l "$TAG" | grep -q "$TAG"; then
echo "⚠️ Local tag $TAG already exists, removing it..."
git tag -d "$TAG"
fi
# Remove existing remote tag if present
if git ls-remote --tags origin "refs/tags/$TAG" | grep -q "$TAG"; then
echo "⚠️ Remote tag $TAG already exists, removing it..."
git push origin ":refs/tags/$TAG"
fi
git tag -a "$TAG" -m "$TRACK_LABEL build $TAG upload_play_store=$UPLOAD_PLAY_STORE upload_github_release=$UPLOAD_GITHUB_RELEASE"
if [ $? -ne 0 ]; then
echo "❌ Failed to create tag."
exit 1
fi
git push origin "$TAG"
if [ $? -ne 0 ]; then
echo "❌ Failed to push tag."
exit 1
fi
echo "✅ Successfully tagged and pushed: $TAG"
if [ "$UPLOAD_PLAY_STORE" = "true" ]; then
echo "🔄 GitHub Actions will build and deploy to Play Store - $TRACK_LABEL track."
fi
if [ "$UPLOAD_GITHUB_RELEASE" = "true" ]; then
echo "📦 GitHub Release will also be created for $TAG."
fi