Skip to content

Commit

Permalink
release: version 0.42.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hesam-init committed Sep 2, 2024
1 parent 9004977 commit 3a7b368
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
9 changes: 1 addition & 8 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,33 @@

set -e # Exit immediately if a command exits with a non-zero status

# Function to increment version
increment_version() {
local IFS='.'
local -a v=($1)
v[2]=$((v[2] + 1))
echo "${v[*]}"
}

# Display all existing tags
echo "Existing tags:"
git tag

# Get the current version, defaulting to 0.1.0 if no tags exist
current_version=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.1.0")

# Remove 'v' prefix if it exists
current_version="${current_version#v}"

# Ask the user for the new version or default to incrementing the current version
read -p "Enter the new version (or press Enter to auto-increment from $current_version): " user_version

if [[ -z "$user_version" ]]; then
new_version="v$(increment_version "$current_version")"
else
new_version="v${user_version#v}" # Ensure 'v' prefix is added if not present
new_version="v${user_version#v}"
fi

# Check if the tag already exists
if git rev-parse "$new_version" >/dev/null 2>&1; then
echo "Error: Tag $new_version already exists. Please choose a different version." >&2
exit 1
fi

# Create and push the new tag
if git tag -a "$new_version" -m "Release $new_version" && git push origin "$new_version"; then
echo "Created and pushed new tag: $new_version"
else
Expand Down
6 changes: 0 additions & 6 deletions remove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,17 @@

set -e # Exit immediately if a command exits with a non-zero status

# Display all existing tags
echo "Existing tags:"
git tag

# Prompt the user to enter the tag to delete
read -p "Enter the tag you want to delete: " tag_to_delete

# Check if the tag exists
if git rev-parse "$tag_to_delete" >/dev/null 2>&1; then
# Confirm deletion
read -p "Are you sure you want to delete the tag '$tag_to_delete' locally and on GitHub? (y/n): " confirmation
if [[ "$confirmation" =~ ^[Yy]$ ]]; then
# Delete the tag locally
git tag -d "$tag_to_delete"
echo "Deleted tag '$tag_to_delete' locally."

# Delete the tag on GitHub
git push --delete origin "$tag_to_delete"
echo "Deleted tag '$tag_to_delete' on GitHub."
else
Expand Down

0 comments on commit 3a7b368

Please sign in to comment.