Skip to content

Commit 4324274

Browse files
committed
🚀 Bump version to 3.0.0
1 parent 4161630 commit 4324274

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

scripts/git_release.sh

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,7 @@ run_git_status() {
3333
add_commit() {
3434
local version="$1"
3535
git add -A
36-
git commit -m "🚀 $version"
37-
}
38-
39-
# Function to merge the current branch into master
40-
merge_into_master() {
41-
local branch=$(get_current_branch)
42-
git checkout master
43-
git merge --no-ff "$branch"
44-
git push origin master
45-
git checkout "$branch"
36+
git commit -m "🚀 Bump version to $version"
4637
}
4738

4839
# Function to install GitHub CLI if not already installed
@@ -65,25 +56,34 @@ create_github_release() {
6556
# Check if GitHub CLI is installed
6657
install_gh_cli
6758

68-
# Get the package version from pubspec.yaml
59+
# Fetch the latest changes from master
60+
echo "Fetching the latest changes from master..."
61+
git fetch origin master || error_exit "Failed to fetch master."
62+
63+
# Merge master into the current branch
64+
current_branch=$(get_current_branch)
65+
echo "Merging master into the current branch ($current_branch)..."
66+
git merge origin/master || error_exit "Failed to merge master into $current_branch."
67+
68+
# Run git status
69+
run_git_status
70+
71+
# Add and commit changes with the current version
6972
current_version=$(get_package_version)
70-
echo "Current version is $current_version"
71-
72-
# Ask for confirmation to merge into master with versioned commit
73-
read -p "Merge into master and create release with commit: '🚀 $current_version'? (y/n): " confirmation
74-
75-
if [[ $confirmation == "y" || $confirmation == "Y" ]]; then
76-
# Perform the Git operations
77-
run_git_status
78-
add_commit "$current_version"
79-
merge_into_master
80-
81-
# Tag the new version
82-
git tag "$current_version"
83-
git push --tags
84-
85-
# Create the GitHub release
86-
create_github_release "$current_version"
87-
else
88-
echo "Merge and release process canceled."
89-
fi
73+
echo "Committing changes with version $current_version..."
74+
add_commit "$current_version"
75+
76+
# Merge the current branch into master
77+
echo "Merging $current_branch into master..."
78+
git checkout master || error_exit "Failed to switch to master branch."
79+
git merge --no-ff "$current_branch" || error_exit "Failed to merge $current_branch into master."
80+
git push origin master || error_exit "Failed to push changes to master."
81+
git checkout "$current_branch" || error_exit "Failed to switch back to $current_branch."
82+
83+
# Tag the new version
84+
echo "Tagging the new version $current_version..."
85+
git tag "$current_version" || error_exit "Failed to tag the new version."
86+
git push --tags || error_exit "Failed to push tags."
87+
88+
# Create the GitHub release
89+
create_github_release "$current_version"

0 commit comments

Comments
 (0)