|
| 1 | +# GeoDa Version Update Scripts Overview |
| 2 | + |
| 3 | +This document provides an overview of all the scripts and tools available for automating GeoDa version updates. |
| 4 | + |
| 5 | +## 📁 Script Files |
| 6 | + |
| 7 | +### 1. GitHub Action Workflow |
| 8 | +- **`.github/workflows/update-version.yml`** - Automated workflow triggered by git tags |
| 9 | + |
| 10 | +### 2. Local Scripts |
| 11 | +- **`update-version.sh`** - Easy-to-use wrapper script with colored output |
| 12 | +- **`scripts/update-version.js`** - Main Node.js script for version updates |
| 13 | +- **`scripts/test-version-update.js`** - Simulation script for testing |
| 14 | +- **`scripts/validate-json.js`** - JSON validation script |
| 15 | + |
| 16 | +### 3. Documentation |
| 17 | +- **`VERSION_UPDATE_README.md`** - User guide |
| 18 | +- **`VERSION_UPDATE_SOLUTION.md`** - Technical solution document |
| 19 | +- **`SCRIPTS_OVERVIEW.md`** - This overview document |
| 20 | + |
| 21 | +## 🚀 Quick Start |
| 22 | + |
| 23 | +### For Automated Updates (Recommended) |
| 24 | +```bash |
| 25 | +# Create and push a tag |
| 26 | +git tag v1.22.0.20 |
| 27 | +git push origin v1.22.0.20 |
| 28 | + |
| 29 | +# GitHub Action will automatically run and create a PR |
| 30 | +``` |
| 31 | + |
| 32 | +### For Local Testing and Manual Updates |
| 33 | +```bash |
| 34 | +# Test what would be changed |
| 35 | +./update-version.sh --dry-run 1.22.0.20 7/31/2025 |
| 36 | + |
| 37 | +# Run actual update |
| 38 | +./update-version.sh 1.22.0.20 7/31/2025 |
| 39 | +``` |
| 40 | + |
| 41 | +## 📋 Script Details |
| 42 | + |
| 43 | +### `update-version.sh` (Wrapper Script) |
| 44 | +**Purpose**: User-friendly interface for running version updates locally |
| 45 | + |
| 46 | +**Features**: |
| 47 | +- ✅ Input validation (version format, date format) |
| 48 | +- ✅ Prerequisites checking (Node.js, script files) |
| 49 | +- ✅ Colored output for better readability |
| 50 | +- ✅ Dry run mode for testing |
| 51 | +- ✅ Help documentation |
| 52 | +- ✅ Error handling and rollback instructions |
| 53 | + |
| 54 | +**Usage**: |
| 55 | +```bash |
| 56 | +./update-version.sh --help # Show help |
| 57 | +./update-version.sh --dry-run 1.22.0.20 # Test changes |
| 58 | +./update-version.sh 1.22.0.20 # Run update |
| 59 | +./update-version.sh 1.22.0.20 7/31/2025 # Run with custom date |
| 60 | +``` |
| 61 | + |
| 62 | +### `scripts/update-version.js` (Main Script) |
| 63 | +**Purpose**: Core logic for updating version information in JSON files |
| 64 | + |
| 65 | +**Features**: |
| 66 | +- ✅ Automatic backup creation |
| 67 | +- ✅ Updates all file types (downloadContent, platform files, nightly) |
| 68 | +- ✅ Multi-language support (de, es, zh-Hans) |
| 69 | +- ✅ JSON validation |
| 70 | +- ✅ Error handling with rollback instructions |
| 71 | +- ✅ Progress reporting |
| 72 | + |
| 73 | +**Usage**: |
| 74 | +```bash |
| 75 | +node scripts/update-version.js 1.22.0.20 |
| 76 | +node scripts/update-version.js 1.22.0.20 7/31/2025 |
| 77 | +``` |
| 78 | + |
| 79 | +### `scripts/test-version-update.js` (Simulation Script) |
| 80 | +**Purpose**: Test the update logic without modifying files |
| 81 | + |
| 82 | +**Features**: |
| 83 | +- ✅ Simulates all update operations |
| 84 | +- ✅ Shows before/after examples |
| 85 | +- ✅ Validates logic correctness |
| 86 | +- ✅ No file modifications |
| 87 | + |
| 88 | +**Usage**: |
| 89 | +```bash |
| 90 | +node scripts/test-version-update.js 1.22.0.20 7/31/2025 |
| 91 | +``` |
| 92 | + |
| 93 | +### `scripts/validate-json.js` (Validation Script) |
| 94 | +**Purpose**: Validate JSON files after updates |
| 95 | + |
| 96 | +**Features**: |
| 97 | +- ✅ Checks JSON syntax |
| 98 | +- ✅ Validates version presence in expected locations |
| 99 | +- ✅ Checks file structure |
| 100 | +- ✅ Reports missing files gracefully |
| 101 | + |
| 102 | +**Usage**: |
| 103 | +```bash |
| 104 | +node scripts/validate-json.js 1.22.0.20 |
| 105 | +``` |
| 106 | + |
| 107 | +## 🔄 Workflow Comparison |
| 108 | + |
| 109 | +### GitHub Action Workflow |
| 110 | +- **Trigger**: Git tag push |
| 111 | +- **Environment**: GitHub Actions runner |
| 112 | +- **Implementation**: Uses the local `update-version.sh` script |
| 113 | +- **Output**: Pull request with changes |
| 114 | +- **Use case**: Production releases |
| 115 | + |
| 116 | +### Local Scripts |
| 117 | +- **Trigger**: Manual execution |
| 118 | +- **Environment**: Local machine |
| 119 | +- **Output**: Direct file changes + backup |
| 120 | +- **Use case**: Testing, development, manual updates |
| 121 | + |
| 122 | +## 🛠️ Prerequisites |
| 123 | + |
| 124 | +### For GitHub Action |
| 125 | +- Repository with GitHub Actions enabled |
| 126 | +- Write permissions for creating pull requests |
| 127 | +- Git tags in format `vX.Y.Z.W` |
| 128 | + |
| 129 | +### For Local Scripts |
| 130 | +- Node.js installed |
| 131 | +- Bash shell (for wrapper script) |
| 132 | +- Repository cloned locally |
| 133 | + |
| 134 | +## 📊 File Update Matrix |
| 135 | + |
| 136 | +| File Type | GitHub Action | Local Scripts | Description | |
| 137 | +|-----------|---------------|---------------|-------------| |
| 138 | +| `downloadContent.json` | ✅ | ✅ | Updates description + adds release entry | |
| 139 | +| `downloadLinux.json` | ✅ | ✅ | Updates current version + moves to history | |
| 140 | +| `downloadMac.json` | ✅ | ✅ | Updates current version + moves to history | |
| 141 | +| `downloadWindows.json` | ✅ | ✅ | Updates current version + moves to history | |
| 142 | +| `downloadNightly.json` | ✅ | ✅ | Adds new release entry | |
| 143 | +| Language variants (de/es/zh-Hans) | ✅ | ✅ | Same updates for all languages | |
| 144 | + |
| 145 | +## 🔧 Error Handling |
| 146 | + |
| 147 | +### GitHub Action |
| 148 | +- Fails fast on errors |
| 149 | +- Provides detailed logs |
| 150 | +- No automatic rollback (manual intervention required) |
| 151 | + |
| 152 | +### Local Scripts |
| 153 | +- Creates automatic backups |
| 154 | +- Provides rollback instructions |
| 155 | +- Continues processing other files on individual failures |
| 156 | +- Shows detailed error messages |
| 157 | + |
| 158 | +## 🧪 Testing Strategy |
| 159 | + |
| 160 | +### Before Production |
| 161 | +1. **Dry run**: `./update-version.sh --dry-run 1.22.0.20` |
| 162 | +2. **Simulation**: `node scripts/test-version-update.js 1.22.0.20` |
| 163 | +3. **Local update**: `./update-version.sh 1.22.0.20` |
| 164 | +4. **Validation**: `node scripts/validate-json.js 1.22.0.20` |
| 165 | +5. **Review changes**: Check modified files |
| 166 | +6. **Test website**: Ensure everything works |
| 167 | + |
| 168 | +### Production Release |
| 169 | +1. **Create tag**: `git tag v1.22.0.20` |
| 170 | +2. **Push tag**: `git push origin v1.22.0.20` |
| 171 | +3. **Monitor action**: Check GitHub Actions tab |
| 172 | +4. **Review PR**: Examine generated pull request |
| 173 | +5. **Merge PR**: Approve and merge changes |
| 174 | + |
| 175 | +## 📈 Benefits |
| 176 | + |
| 177 | +### Automation Benefits |
| 178 | +- **Time saving**: Reduces manual work from hours to minutes |
| 179 | +- **Accuracy**: Eliminates human errors in version numbers |
| 180 | +- **Consistency**: Ensures uniform updates across all files |
| 181 | +- **Audit trail**: Creates pull requests for review |
| 182 | + |
| 183 | +### Local Script Benefits |
| 184 | +- **Testing**: Verify changes before production |
| 185 | +- **Development**: Test new features locally |
| 186 | +- **Manual updates**: Handle special cases |
| 187 | +- **Backup safety**: Automatic backups with rollback |
| 188 | + |
| 189 | +## 🚨 Troubleshooting |
| 190 | + |
| 191 | +### Common Issues |
| 192 | +1. **Invalid version format**: Use `X.Y.Z.W` format (e.g., `1.22.0.20`) |
| 193 | +2. **Missing Node.js**: Install Node.js for local scripts |
| 194 | +3. **Permission errors**: Ensure write permissions for local files |
| 195 | +4. **GitHub token issues**: Check repository permissions for actions |
| 196 | + |
| 197 | +### Recovery |
| 198 | +- **Local scripts**: Use backup directory to restore files |
| 199 | +- **GitHub Action**: Manually revert changes or re-run action |
| 200 | +- **Validation errors**: Check JSON syntax and file structure |
| 201 | + |
| 202 | +## 🔮 Future Enhancements |
| 203 | + |
| 204 | +Potential improvements for the scripts: |
| 205 | +- Support for different version formats |
| 206 | +- Custom date formats |
| 207 | +- Additional file types |
| 208 | +- Email notifications |
| 209 | +- Integration with release notes generation |
| 210 | +- Web interface for non-technical users |
0 commit comments