-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.sh
58 lines (52 loc) · 1.63 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
53
54
55
56
57
58
#!/bin/bash
# Capture the version argument
version=$1
echo "Arguments: $*"
if [ -z "$version" ]; then
echo "You must provide a version number. Usage: hotfix <version>"
exit 1
fi
# Function to check if a command exists
is_command_available() {
command -v $1 >/dev/null 2>&1
}
# Check for lolcat and GitHub CLI (gh)
is_command_available lolcat
is_lolcat_available=$?
is_command_available gh
is_gh_available=$?
if [ $is_lolcat_available -eq 0 ]; then
# Use the provided version to create a release branch
echo "Creating release $version" | lolcat
git flow release start $version | lolcat
echo "Release branch created" | lolcat
# Rest of your commands with lolcat
echo "Release works" | lolcat
npm version patch | lolcat
echo "made version patch" | lolcat
git add . | lolcat && git commit -m "docs: version bump" | lolcat
echo "committed" | lolcat
git flow release publish | lolcat
echo "published the branch 🎉" | lolcat
if [ $is_gh_available -eq 0 ]; then
gh pr create --title "Release $version" --body "Release $version" --base main
echo "created the PR 🎉" | lolcat
fi
else
# Use the provided version to create a release branch
echo "Creating release $version"
git flow release start $version
echo "Release branch created"
# Rest of your commands
echo "Release works"
npm version patch
echo "made version patch"
git add . && git commit -m "docs: version bump"
echo "committed"
git flow release publish
echo "published the branch 🎉"
if [ $is_gh_available -eq 0 ]; then
gh pr create --title "Release $version" --body "Release $version" --base main
echo "created the PR 🎉"
fi
fi