-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.sh
executable file
·52 lines (44 loc) · 1.56 KB
/
release.sh
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
#!/bin/bash
set -e
# Function to update version in gradle.properties
# Uses an approach compatible with both GNU and BSD sed
update_version() {
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' "s/^version=.*/version=$1/" gradle.properties
else
sed -i "s/^version=.*/version=$1/" gradle.properties
fi
}
# Function to confirm with the user
confirm() {
echo "You are about to release $1 and preparing $2"
read -p "Confirm (Y/N): " choice
case "$choice" in
Y|y ) echo "Proceeding with version $1";;
N|n ) echo "Cancelled"; exit 1;;
* ) echo "Invalid response"; exit 1;;
esac
}
echo "Release Script"
# Get the release version and next version
read -p "Enter the release version (e.g., 1.0.0): " release_version
read -p "Enter the next snapshot version (e.g., 1.1.0-SNAPSHOT): " next_version
# Confirm versions
confirm $release_version $next_version
# Update to release version
update_version $release_version
echo "Updated version to $release_version in gradle.properties"
git commit -am "Prepare version $release_version"
echo "Committed changes for version $release_version"
git tag -am "Version $release_version" $release_version
echo "Tagged version $release_version"
git push --tags
echo "Pushed tags to remote"
# Update to next snapshot version
update_version $next_version
echo "Updated version to $next_version in gradle.properties"
git commit -am "Prepare next development version"
echo "Committed changes for next development version"
git push
echo "Pushed changes and tags to remote"
echo "Release process completed."