-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·68 lines (55 loc) · 1.48 KB
/
release.sh
File metadata and controls
executable file
·68 lines (55 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
# Automated release script for querybuilder
# Usage: ./release.sh [patch|minor|major] [message]
set -e
# Default to patch if no argument provided
BUMP_TYPE=${1:-patch}
MESSAGE=${2:-"Release"}
# Get current version
CURRENT_VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
echo "Current version: $CURRENT_VERSION"
# Remove 'v' prefix for version manipulation
CURRENT_VERSION=${CURRENT_VERSION#v}
# Split version into parts
IFS='.' read -ra VERSION_PARTS <<< "$CURRENT_VERSION"
MAJOR=${VERSION_PARTS[0]:-0}
MINOR=${VERSION_PARTS[1]:-0}
PATCH=${VERSION_PARTS[2]:-0}
# Bump version based on type
case $BUMP_TYPE in
major)
MAJOR=$((MAJOR + 1))
MINOR=0
PATCH=0
;;
minor)
MINOR=$((MINOR + 1))
PATCH=0
;;
patch)
PATCH=$((PATCH + 1))
;;
*)
echo "Invalid bump type. Use: patch, minor, or major"
exit 1
;;
esac
NEW_VERSION="v$MAJOR.$MINOR.$PATCH"
echo "New version: $NEW_VERSION"
# Confirm release
read -p "Create release $NEW_VERSION? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Release cancelled"
exit 1
fi
# Run tests first
echo "Running tests..."
go test -v ./...
# Create and push tag
echo "Creating tag..."
git tag -a "$NEW_VERSION" -m "$MESSAGE $NEW_VERSION"
echo "Pushing tag..."
git push origin "$NEW_VERSION"
echo "✅ Release $NEW_VERSION created successfully!"
echo "Check progress at: https://github.com/hojabri/querybuilder/actions"