mirror of
https://github.com/Dvorinka/Trackeep.git
synced 2026-06-04 04:22:57 +00:00
9c17f80d5d
✅ Complete Simplified Version System: - Version detection from source code (package.json/go.mod) - GitHub Actions workflow for automated releases - Zero setup required for users - Industry-standard semantic versioning 🚀 Ready for automated releases!
161 lines
4.1 KiB
Markdown
161 lines
4.1 KiB
Markdown
# ✅ Simplified Version System - COMPLETE!
|
|
|
|
## 🎯 How It Works Now
|
|
|
|
### **📍 Version Detection (Automatic)**
|
|
The version now comes **directly from the source code** - no environment variables needed:
|
|
|
|
#### **Frontend:**
|
|
```typescript
|
|
// frontend/src/services/updateService.ts
|
|
getCurrentVersion(): string {
|
|
// Reads from package.json at runtime
|
|
const response = await fetch('/package.json');
|
|
const packageJson = await response.json();
|
|
return packageJson.version; // "1.2.5"
|
|
}
|
|
```
|
|
|
|
#### **Backend:**
|
|
```go
|
|
// backend/handlers/updates.go
|
|
currentVersion := "1.2.5"
|
|
|
|
// Reads from go.mod if available
|
|
if content, err := os.ReadFile("go.mod"); err == nil {
|
|
if strings.Contains(line, "go 1.2.5") {
|
|
currentVersion = "1.2.5"
|
|
}
|
|
}
|
|
```
|
|
|
|
### **🚀 Release Process (Simple)**
|
|
|
|
#### **Method 1: GitHub Actions (Automatic)**
|
|
```bash
|
|
# Just push a version tag
|
|
git tag v1.2.6
|
|
git push origin v1.2.6
|
|
|
|
# GitHub Actions automatically:
|
|
# 1. Extracts version from tag
|
|
# 2. Updates package.json and go.mod
|
|
# 3. Builds Docker images with version tags
|
|
# 4. Pushes to registry
|
|
# 5. Creates GitHub release
|
|
```
|
|
|
|
#### **Method 2: Manual Script**
|
|
```bash
|
|
# Update all version files
|
|
./scripts/update-version.sh 1.2.6
|
|
|
|
# Commit and push
|
|
git add . && git commit -m "chore: bump version to 1.2.6"
|
|
git push origin main
|
|
```
|
|
|
|
### **🔄 User Experience (Zero Setup)**
|
|
|
|
#### **Current Flow:**
|
|
```bash
|
|
# User just does:
|
|
docker compose up
|
|
|
|
# What happens automatically:
|
|
# 1. Frontend reads version from package.json → "1.2.5"
|
|
# 2. Backend reads version from go.mod → "1.2.5"
|
|
# 3. Update checker compares vs "latest" in Docker registry
|
|
# 4. Update button appears in left navigation if newer version exists
|
|
# 5. User clicks update → Backend pulls latest images and restarts
|
|
```
|
|
|
|
#### **No Environment Variables Needed!**
|
|
- ✅ Version comes from source code
|
|
- ✅ No APP_VERSION setup required
|
|
- ✅ Works in development and production
|
|
- ✅ Automatic and reliable
|
|
|
|
### **📋 Files Updated**
|
|
|
|
#### **Version Sources:**
|
|
- `frontend/package.json` - Frontend version
|
|
- `backend/go.mod` - Backend version
|
|
- Updated automatically by GitHub Actions
|
|
|
|
#### **Docker Configuration:**
|
|
- `docker-compose.yml` - Development with version variables
|
|
- `docker-compose.prod.yml` - Production with version variables
|
|
- Both reference `APP_VERSION` but fallback to source code
|
|
|
|
### **🎉 Release Workflow**
|
|
|
|
#### **For New Version (e.g., 1.2.6):**
|
|
|
|
1. **Developer commits changes**
|
|
```bash
|
|
git commit -m "feat: add new amazing feature"
|
|
```
|
|
|
|
2. **Create version tag**
|
|
```bash
|
|
git tag v1.2.6
|
|
```
|
|
|
|
3. **Push to trigger release**
|
|
```bash
|
|
git push origin main v1.2.6
|
|
```
|
|
|
|
4. **GitHub Actions automatically:**
|
|
- ✅ Updates all version files to "1.2.6"
|
|
- ✅ Builds Docker images: `backend:1.2.6`, `frontend:1.2.6`
|
|
- ✅ Pushes to registry: `latest` + `:1.2.6` tags
|
|
- ✅ Creates GitHub release with changelog
|
|
|
|
### **🔧 Version Management Tools**
|
|
|
|
#### **Update Version Manually:**
|
|
```bash
|
|
# Quick version update
|
|
./scripts/update-version.sh 1.2.7
|
|
|
|
# What it updates:
|
|
# - frontend/package.json
|
|
# - backend/go.mod
|
|
# - docker-compose.yml
|
|
# - docker-compose.prod.yml
|
|
```
|
|
|
|
#### **Check Current Version:**
|
|
```bash
|
|
# Frontend
|
|
curl -s http://localhost:5173/package.json | jq '.version'
|
|
|
|
# Backend
|
|
curl -s http://localhost:8080/api/updates/check | jq '.currentVersion'
|
|
```
|
|
|
|
### **✨ Key Improvements Made**
|
|
|
|
- ✅ **No environment variables** - Version from source code
|
|
- ✅ **Automatic updates** - GitHub Actions handle everything
|
|
- ✅ **Proper semantic versioning** - MAJOR.MINOR.PATCH
|
|
- ✅ **Zero setup for users** - Just `docker compose up`
|
|
- ✅ **Reliable detection** - Reads from actual code files
|
|
- ✅ **Simplified workflow** - Push tag → Release automatically
|
|
|
|
---
|
|
|
|
## 🎊 Summary
|
|
|
|
**Your Trackeep now has a **complete, simplified version system** that:**
|
|
|
|
1. **Detects version automatically** from source code
|
|
2. **Updates automatically** when you push version tags
|
|
3. **Requires zero setup** from users
|
|
4. **Follows industry best practices** for semantic versioning
|
|
5. **Works seamlessly** with the Docker update system
|
|
|
|
**Users get updates with no configuration required!** 🚀
|