|
1 | 1 | #!/bin/bash |
2 | 2 |
|
3 | | -# Automated release script for go-sol-sign |
4 | | -# Usage: ./release.sh [version] |
5 | | -# Example: ./release.sh 1.2.0 |
| 3 | +# Legacy release script - now redirects to automated version-bump.sh |
| 4 | +# This script is kept for backwards compatibility |
6 | 5 |
|
7 | | -set -e |
8 | | - |
9 | | -# Colors for output |
10 | | -RED='\033[0;31m' |
11 | | -GREEN='\033[0;32m' |
12 | | -YELLOW='\033[1;33m' |
13 | | -BLUE='\033[0;34m' |
14 | | -NC='\033[0m' |
15 | | - |
16 | | -# Parse version argument |
17 | | -if [ -z "$1" ]; then |
18 | | - echo -e "${RED}Error: Version number required${NC}" |
19 | | - echo "Usage: $0 <version>" |
20 | | - echo "Example: $0 1.2.0" |
21 | | - exit 1 |
22 | | -fi |
23 | | - |
24 | | -VERSION="$1" |
25 | | -TAG="v$VERSION" |
26 | | - |
27 | | -echo -e "${GREEN}🚀 Preparing release $TAG${NC}" |
| 6 | +echo "🔄 This script has been replaced by the automated version-bump.sh" |
| 7 | +echo "" |
| 8 | +echo "New usage:" |
| 9 | +echo " ./version-bump.sh patch # Bug fixes (1.2.3 -> 1.2.4)" |
| 10 | +echo " ./version-bump.sh minor # New features (1.2.3 -> 1.3.0)" |
| 11 | +echo " ./version-bump.sh major # Breaking changes (1.2.3 -> 2.0.0)" |
28 | 12 | echo "" |
29 | 13 |
|
30 | | -# Verify we're on main branch |
31 | | -CURRENT_BRANCH=$(git branch --show-current) |
32 | | -if [ "$CURRENT_BRANCH" != "main" ]; then |
33 | | - echo -e "${YELLOW}Warning: Not on main branch (current: $CURRENT_BRANCH)${NC}" |
34 | | - read -p "Continue anyway? (y/N): " -n 1 -r |
35 | | - echo |
36 | | - if [[ ! $REPLY =~ ^[Yy]$ ]]; then |
37 | | - echo "Release cancelled." |
38 | | - exit 0 |
39 | | - fi |
40 | | -fi |
41 | | - |
42 | | -# Check for uncommitted changes |
43 | | -if ! git diff --quiet || ! git diff --staged --quiet; then |
44 | | - echo -e "${RED}Error: You have uncommitted changes${NC}" |
45 | | - echo "Please commit or stash your changes before releasing." |
| 14 | +# Check if version-bump.sh exists and is executable |
| 15 | +if [[ -x "./version-bump.sh" ]]; then |
| 16 | + echo "🚀 Running automated version bump..." |
| 17 | + ./version-bump.sh patch # Default to patch for backwards compatibility |
| 18 | +else |
| 19 | + echo "❌ version-bump.sh not found or not executable" |
| 20 | + echo "Please run: chmod +x version-bump.sh" |
46 | 21 | exit 1 |
47 | 22 | fi |
48 | | - |
49 | | -# Update version in files |
50 | | -echo -e "${BLUE}📝 Updating version to $VERSION in source files...${NC}" |
51 | | - |
52 | | -# Update main.go |
53 | | -sed -i "s/Version = \".*\"/Version = \"$VERSION\"/" main.go |
54 | | - |
55 | | -# Update build-release.sh |
56 | | -sed -i "s/VERSION=\".*\"/VERSION=\"$VERSION\"/" build-release.sh |
57 | | - |
58 | | -# Update install.sh |
59 | | -sed -i "s/VERSION=\".*\"/VERSION=\"$VERSION\"/" install.sh |
60 | | - |
61 | | -# Update packaging files |
62 | | -sed -i "s/Version: .*/Version: $VERSION/" packaging/rpm/go-sol-sign.spec |
63 | | - |
64 | | -echo -e "${GREEN}✅ Version updated in all files${NC}" |
65 | | - |
66 | | -# Run tests |
67 | | -echo -e "${BLUE}🧪 Running tests...${NC}" |
68 | | -go test ./... |
69 | | -echo -e "${GREEN}✅ All tests passed${NC}" |
70 | | - |
71 | | -# Build release locally to verify |
72 | | -echo -e "${BLUE}🔨 Building release locally...${NC}" |
73 | | -chmod +x build-release.sh |
74 | | -./build-release.sh |
75 | | -echo -e "${GREEN}✅ Build successful${NC}" |
76 | | - |
77 | | -# Clean up build artifacts |
78 | | -rm -rf dist/ |
79 | | - |
80 | | -# Commit version changes |
81 | | -echo -e "${BLUE}📝 Committing version updates...${NC}" |
82 | | -git add main.go build-release.sh install.sh packaging/rpm/go-sol-sign.spec |
83 | | -git commit -m "chore: bump version to $VERSION |
84 | | -
|
85 | | -- Update version in main.go, build-release.sh, and install.sh |
86 | | -- Update RPM spec file version |
87 | | -- Prepare for $TAG release" |
88 | | - |
89 | | -# Create and push tag |
90 | | -echo -e "${BLUE}🏷️ Creating and pushing tag $TAG...${NC}" |
91 | | -git tag -a "$TAG" -m "Release $TAG |
92 | | -
|
93 | | -Automated release of go-sol-sign version $VERSION |
94 | | -
|
95 | | -Changes: |
96 | | -- Updated binary name to go-sol-sign |
97 | | -- Improved install script with non-interactive support |
98 | | -- Enhanced CI/CD with automatic version management |
99 | | -- Updated packaging for all platforms" |
100 | | - |
101 | | -git push origin main |
102 | | -git push origin "$TAG" |
103 | | - |
104 | | -echo "" |
105 | | -echo -e "${GREEN}🎉 Release $TAG created successfully!${NC}" |
106 | | -echo "" |
107 | | -echo -e "${BLUE}Next steps:${NC}" |
108 | | -echo "1. GitHub Actions will automatically build and publish the release" |
109 | | -echo "2. Monitor the progress at: https://github.com/Aryamanraj/go-sol-sign/actions" |
110 | | -echo "3. The release will be available at: https://github.com/Aryamanraj/go-sol-sign/releases/tag/$TAG" |
111 | | -echo "" |
112 | | -echo -e "${BLUE}Install command will be:${NC}" |
113 | | -echo "curl -fsSL https://raw.githubusercontent.com/Aryamanraj/go-sol-sign/main/install.sh | bash" |
0 commit comments