Skip to content

Commit

Permalink
tools: added script to sign+tag git commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Pospesel committed Mar 22, 2024
1 parent cfa98b8 commit 4eaba40
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tools/sign-tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

# Check if at least two arguments are provided
if [ "$#" -lt 2 ]; then
echo "Usage: $0 channel version [commit]"
exit 1
fi

# Assign arguments to variables
channel=$1
version=$2
commit=${3:-HEAD}

# Check if the channel name is valid
valid_channels=("release" "alpha")
if ! [[ " ${valid_channels[@]} " =~ " $channel " ]]; then
echo "Invalid channel name. Valid channel names are: ${valid_channels[*]}"
exit 1
fi

# Validate semantic version format
if ! [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid version format. Please provide semantic version (e.g., 1.2.3)"
exit 1
fi

# Sign and tag the specified git commit
tag_name="v${version}-${channel}"
commit_message="tagging ${tag_name}"

echo "Signing and tagging commit $commit with tag name: ${tag_name}"
git tag -s "$tag_name" "$commit" -m "$commit_message"

0 comments on commit 4eaba40

Please sign in to comment.