-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tools: added script to sign+tag git commit
- Loading branch information
Richard Pospesel
committed
Mar 13, 2024
1 parent
e66990f
commit 3ad4c5a
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Check if three arguments are provided | ||
if [ "$#" -ne 2 ]; then | ||
echo "Usage: $0 crate version" | ||
exit 1 | ||
fi | ||
|
||
# Assign arguments to variables | ||
crate=$1 | ||
version=$2 | ||
|
||
# Check if the crate name is valid | ||
valid_crates=("honk-rpc" "tor-interface" "gosling" "cgosling") | ||
if ! [[ " ${valid_crates[@]} " =~ " $crate " ]]; then | ||
echo "Invalid crate name. Valid crate names are: ${valid_crates[*]}" | ||
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 current git HEAD | ||
tag_name="${crate}-v${version}" | ||
commit_message="signing ${crate} version ${version}" | ||
|
||
echo "Signing and tagging with tag name: ${tag_name}" | ||
git tag -s "$tag_name" -m "$commit_message" |