Skip to content

Commit e86b36e

Browse files
committed
Add version update automation and sync language variants to 1.22.0.18
- Add GitHub Action workflow for automated version updates - Add local scripts for testing and manual updates - Add comprehensive documentation - Sync all language variants (de, es, zh-Hans) to version 1.22.0.18 - Update .gitignore to exclude backup directories - Add validation and testing scripts
1 parent ca7af71 commit e86b36e

30 files changed

Lines changed: 2485 additions & 217 deletions
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Update Version Information
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Triggers on version tags like v1.22.0.20
7+
8+
jobs:
9+
update-version:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
with:
16+
token: ${{ secrets.GITHUB_TOKEN }}
17+
fetch-depth: 0
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '18'
23+
24+
- name: Extract version from tag
25+
id: version
26+
run: |
27+
# Extract version from tag (remove 'v' prefix)
28+
VERSION=${GITHUB_REF#refs/tags/v}
29+
echo "version=$VERSION" >> $GITHUB_OUTPUT
30+
echo "Extracted version: $VERSION"
31+
32+
# Generate current date in M/D/YYYY format
33+
DATE=$(date +'%-m/%-d/%Y')
34+
echo "date=$DATE" >> $GITHUB_OUTPUT
35+
echo "Generated date: $DATE"
36+
37+
- name: Update version information
38+
run: |
39+
VERSION="${{ steps.version.outputs.version }}"
40+
DATE="${{ steps.version.outputs.date }}"
41+
42+
echo "Updating version to: $VERSION"
43+
echo "Using date: $DATE"
44+
45+
# Run the version update script
46+
./update-version.sh "$VERSION" "$DATE"
47+
48+
- name: Validate JSON files
49+
run: |
50+
VERSION="${{ steps.version.outputs.version }}"
51+
node scripts/validate-json.js "$VERSION"
52+
53+
- name: Create Pull Request
54+
uses: peter-evans/create-pull-request@v5
55+
with:
56+
token: ${{ secrets.GITHUB_TOKEN }}
57+
commit-message: "Update version to ${{ steps.version.outputs.version }}"
58+
title: "Update version to ${{ steps.version.outputs.version }}"
59+
body: |
60+
This PR updates the version information to ${{ steps.version.outputs.version }}.
61+
62+
Changes made:
63+
- Updated version description in downloadContent.json
64+
- Added new release entry in downloadContent.json
65+
- Updated currentVersion and moved previous version to PreviousVersions in platform-specific files
66+
- Added new release entry in downloadNightly.json
67+
- Applied same changes to all language variants (de, es, zh-Hans)
68+
69+
Auto-generated by GitHub Actions on tag ${{ github.ref }}
70+
branch: update-version-${{ steps.version.outputs.version }}
71+
base: main
72+
delete-branch: true

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@ build
1919
.DS_Store
2020
.env
2121
.env.local
22-
.env.*.local
22+
.env.*.local
23+
24+
# Backup directories created by version update scripts
25+
backup-*/

SCRIPTS_OVERVIEW.md

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
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

Comments
 (0)