Skip to content

Commit 2e9c63c

Browse files
committed
feat: add automated version bumping and release workflow
- Add version-bump.sh for automatic version management - Update release.sh to use new automation - Add WORKFLOW.md documentation for development process - Update README.md with release automation info - Eliminates manual git tag/push steps
1 parent 33a105d commit 2e9c63c

File tree

4 files changed

+355
-106
lines changed

4 files changed

+355
-106
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,22 @@ go mod tidy
210210
go test ./...
211211
```
212212

213+
### Automated Releases
214+
We use automated version bumping for releases:
215+
216+
```bash
217+
# For bug fixes (1.3.0 -> 1.3.1)
218+
./version-bump.sh patch
219+
220+
# For new features (1.3.0 -> 1.4.0)
221+
./version-bump.sh minor
222+
223+
# For breaking changes (1.3.0 -> 2.0.0)
224+
./version-bump.sh major
225+
```
226+
227+
See [WORKFLOW.md](WORKFLOW.md) for detailed development workflow.
228+
213229
## 📝 License
214230

215231
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

WORKFLOW.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Development Workflow
2+
3+
This document outlines the automated development and release workflow for go-sol-sign.
4+
5+
## Quick Release Commands
6+
7+
### Automated Version Bumping (Recommended)
8+
9+
```bash
10+
# For bug fixes (1.3.0 -> 1.3.1)
11+
./version-bump.sh patch
12+
13+
# For new features (1.3.0 -> 1.4.0)
14+
./version-bump.sh minor
15+
16+
# For breaking changes (1.3.0 -> 2.0.0)
17+
./version-bump.sh major
18+
```
19+
20+
### Legacy Commands (Still Works)
21+
22+
```bash
23+
# Will automatically run patch version bump
24+
./release.sh
25+
```
26+
27+
## What Happens Automatically
28+
29+
The `version-bump.sh` script handles everything:
30+
31+
1. **🔍 Validation**
32+
- Checks if repository is clean
33+
- Verifies you're on main branch
34+
- Ensures tests pass
35+
36+
2. **📊 Version Management**
37+
- Automatically detects current version from git tags
38+
- Calculates new version based on bump type
39+
- Shows you the changes before proceeding
40+
41+
3. **🚀 Release Process**
42+
- Creates annotated git tag with changelog
43+
- Pushes tag to GitHub
44+
- Triggers GitHub Actions automatically
45+
- Builds multi-platform binaries
46+
- Creates GitHub release with assets
47+
48+
4. **⏱️ Timeline**
49+
- Immediate: Tag created and pushed
50+
- 3-5 minutes: GitHub Actions completes build
51+
- Ready: Release available for download
52+
53+
## Development Workflow
54+
55+
### Day-to-Day Development
56+
57+
```bash
58+
# 1. Make your changes
59+
git add .
60+
git commit -m "feat: add new feature"
61+
62+
# 2. Push to main
63+
git push
64+
65+
# 3. When ready to release
66+
./version-bump.sh minor # or patch/major
67+
```
68+
69+
### Release Types
70+
71+
- **patch**: Bug fixes, documentation updates, small improvements
72+
- **minor**: New features, enhancements (backwards compatible)
73+
- **major**: Breaking changes, major rewrites
74+
75+
## Examples
76+
77+
```bash
78+
# After fixing a bug
79+
./version-bump.sh patch
80+
81+
# After adding base58 support
82+
./version-bump.sh minor
83+
84+
# After changing CLI interface significantly
85+
./version-bump.sh major
86+
```
87+
88+
## Manual Override (Advanced)
89+
90+
If you need to create a specific version:
91+
92+
```bash
93+
# Create tag manually
94+
git tag v1.5.0
95+
git push origin v1.5.0
96+
```
97+
98+
## Monitoring Releases
99+
100+
- **GitHub Actions**: https://github.com/Aryamanraj/go-sol-sign/actions
101+
- **Releases**: https://github.com/Aryamanraj/go-sol-sign/releases
102+
103+
## Troubleshooting
104+
105+
If a release fails:
106+
107+
1. Check GitHub Actions logs
108+
2. Ensure all tests pass locally: `go test ./...`
109+
3. Verify repository is clean: `git status`
110+
4. Try running `./version-bump.sh` again
111+
112+
The automation handles all the complex parts - just focus on writing great code! 🚀

release.sh

Lines changed: 15 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,22 @@
11
#!/bin/bash
22

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
65

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)"
2812
echo ""
2913

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"
4621
exit 1
4722
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

Comments
 (0)