Skip to content

Commit 650b001

Browse files
Enhance release tagging and CI/CD robustness
- Add explicit target commit support to create-release-tag.sh - Show commit details before tagging for verification - Add user confirmation before proceeding with tag creation - Improve GitHub Actions tag verification with explicit tag fetching - Add debugging information for tag verification process These changes ensure signed tags point to the exact intended commit and provide better visibility into the release process.
1 parent 8ee1045 commit 650b001

2 files changed

Lines changed: 35 additions & 2 deletions

File tree

.github/workflows/publish.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
uses: actions/checkout@v4
2828
with:
2929
fetch-depth: 0 # Fetch all history for tag verification
30+
fetch-tags: true # Explicitly fetch all tags
3031

3132
# Verify tag signature for release builds
3233
- name: Verify tag signature
@@ -44,6 +45,17 @@ jobs:
4445
exit 1
4546
fi
4647
48+
# Ensure the tag exists and is available locally
49+
echo "🔍 Checking if tag exists locally..."
50+
if ! git tag -l | grep -q "^$TAG$"; then
51+
echo "⚠️ Tag not found locally, fetching..."
52+
git fetch origin "refs/tags/$TAG:refs/tags/$TAG"
53+
fi
54+
55+
# Show tag information for debugging
56+
echo "📋 Tag information:"
57+
git show --no-patch --format=" Type: %s%n Author: %an <%ae>%n Date: %ai" "$TAG" || echo "Could not show tag info"
58+
4759
# Verify the tag signature (will fail if tag is unsigned or signature is bad)
4860
if git verify-tag "$TAG"; then
4961
echo "✅ Tag signature verified successfully"

create-release-tag.sh

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ print_error() {
3131

3232
# Check arguments
3333
if [ $# -lt 1 ]; then
34-
print_error "Usage: $0 <version> [message]"
34+
print_error "Usage: $0 <version> [message] [commit]"
3535
echo "Example: $0 0.4.3 'Enhanced CI/CD with security features'"
36+
echo " $0 0.4.3 'Release 0.4.3' abc123def # tag specific commit"
3637
exit 1
3738
fi
3839

3940
VERSION="$1"
4041
MESSAGE="${2:-Fennel node v$VERSION}"
42+
TARGET_COMMIT="${3:-HEAD}" # Default to HEAD if no commit specified
4143

4244
# Validate version format
4345
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
@@ -65,6 +67,25 @@ if ! git diff --quiet || ! git diff --staged --quiet; then
6567
fi
6668
fi
6769

70+
# Show current commit information
71+
CURRENT_COMMIT=$(git rev-parse $TARGET_COMMIT)
72+
if [ "$TARGET_COMMIT" = "HEAD" ]; then
73+
print_status "Target commit (HEAD): $CURRENT_COMMIT"
74+
else
75+
print_status "Target commit: $CURRENT_COMMIT"
76+
fi
77+
print_status "Commit details:"
78+
git show --no-patch --format=" %H - %s (%an, %ar)" $TARGET_COMMIT
79+
80+
echo ""
81+
print_status "This tag will point to the above commit."
82+
read -p "Proceed with tagging this commit? (Y/n): " -n 1 -r
83+
echo
84+
if [[ $REPLY =~ ^[Nn]$ ]]; then
85+
print_status "Tagging cancelled."
86+
exit 0
87+
fi
88+
6889
# Check GPG setup
6990
print_status "Checking GPG configuration..."
7091
if ! git config user.signingkey &>/dev/null; then
@@ -77,7 +98,7 @@ print_success "Using GPG key: $SIGNING_KEY"
7798

7899
# Create the signed tag
79100
print_status "Creating signed tag..."
80-
if git tag -s "$TAG_NAME" -m "$MESSAGE"; then
101+
if git tag -s "$TAG_NAME" -m "$MESSAGE" "$TARGET_COMMIT"; then
81102
print_success "Signed tag created: $TAG_NAME"
82103
else
83104
print_error "Failed to create signed tag"

0 commit comments

Comments
 (0)