-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake-release.bash
executable file
·76 lines (61 loc) · 2.13 KB
/
make-release.bash
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
#!/usr/bin/env bash
#==========================================================================================
# SCRIPT VARIABLES
#==========================================================================================
SCRIPTFOLDER=$(dirname $(realpath $0))
#==========================================================================================
# HELPER FUNCTIONS
#==========================================================================================
GREEN=$(tput setaf 10)
BOLD=$(tput bold)
RESET=$(tput sgr0)
print_item()
{
echo -e "\n${GREEN}${BOLD}==>${RESET} ${BOLD}$1${RESET}"
}
#==========================================================================================
# MAKE RELEASE
#==========================================================================================
make_release()
{
echo " "
echo "--------------------------------------------------------------------------"
echo "-- ${GREEN}MAKE RELEASE${RESET}"
echo "--------------------------------------------------------------------------"
local version=""
local confirm="n"
if [[ -z "$1" ]]; then
echo ""
read -e -p "Input release version: " version
else
version="$1"
fi
echo ""
echo "Making release for version ${GREEN}${version}${RESET}"
read -r -s -n 1 -p "Are you sure you want to continue [y/N]: " confirm
echo ""
if [[ "${confirm,,}" == "y" ]]; then
print_item "Updating version in Cargo.toml"
sed -i "/^version = / c version = \"${version}\"" "$SCRIPTFOLDER/Cargo.toml"
print_item "Building release version"
cargo build --release
cp "$SCRIPTFOLDER/target/release/pacview" "$SCRIPTFOLDER"
print_item "Committing git changes"
git add "$SCRIPTFOLDER/Cargo.toml"
git add "$SCRIPTFOLDER/Cargo.lock"
git add "$SCRIPTFOLDER/src/app.rs"
git add "$SCRIPTFOLDER/pacview"
git commit -m "Bump version to ${version}"
print_item "Adding git tag ($version)"
git tag "$version"
fi
echo ""
echo "Pushing changes to upstream repository ${GREEN}${version}${RESET}"
read -r -s -n 1 -p "Are you sure you want to continue [y/N]: " confirm
echo ""
if [[ "${confirm,,}" == "y" ]]; then
git push
git push origin --tags
fi
}
make_release "$1"