1+ #! /bin/bash
2+
3+ # Automatic release script
4+ # Usage: ./release.sh 1.2.3
5+
6+ if [ $# -eq 0 ]; then
7+ echo " ❌ Usage: $0 <version>"
8+ echo " Example: $0 1.2.3"
9+ exit 1
10+ fi
11+
12+ NEW_VERSION=" $1 "
13+
14+ # Automatically detect the current version from package.json
15+ CURRENT_VERSION=$( grep ' "version"' package.json | head -1 | sed ' s/.*"version": "\(.*\)".*/\1/' )
16+
17+ echo " 🚀 Automatic release: $CURRENT_VERSION → $NEW_VERSION "
18+
19+ # Verify that we are in the correct directory
20+ if [ ! -f " package.json" ] || [ ! -f " src-tauri/Cargo.toml" ]; then
21+ echo " ❌ Error: Run the script from the project root"
22+ exit 1
23+ fi
24+
25+ echo " 📝 Updating versions in all files..."
26+
27+ # 1. package.json
28+ sed -i " s/\" version\" : \" $CURRENT_VERSION \" /\" version\" : \" $NEW_VERSION \" /g" package.json
29+
30+ # 2. src-tauri/Cargo.toml
31+ sed -i " s/version = \" $CURRENT_VERSION \" /version = \" $NEW_VERSION \" /g" src-tauri/Cargo.toml
32+
33+ # 3. src-tauri/tauri.conf.json
34+ if [ -f " src-tauri/tauri.conf.json" ]; then
35+ sed -i " s/\" version\" : \" $CURRENT_VERSION \" /\" version\" : \" $NEW_VERSION \" /g" src-tauri/tauri.conf.json
36+ fi
37+
38+ # 4. src-tauri/tauri.conf.json.example
39+ sed -i " s/\" version\" : \" $CURRENT_VERSION \" /\" version\" : \" $NEW_VERSION \" /g" src-tauri/tauri.conf.json.example
40+
41+ # 5. Footer component
42+ sed -i " s/>v$CURRENT_VERSION </>v$NEW_VERSION </g" src/app/shared/components/footer/footer.component.html
43+
44+ # 6. setup.sh
45+ sed -i " s/git tag v$CURRENT_VERSION /git tag v$NEW_VERSION /g" setup.sh
46+
47+ # 7. Update Cargo.lock
48+ echo " 🔧 Updating Cargo.lock..."
49+ cd src-tauri
50+ cargo update
51+ cd ..
52+
53+ echo " ✅ All versions have been updated"
54+
55+ # Verify changes
56+ echo " 📋 Modified files:"
57+ git diff --name-only
58+
59+ echo " 🤔 Do you want to proceed with the commit and tag? (y/N)"
60+ read -r response
61+ if [[ " $response " =~ ^([yY][eE][sS]| [yY])$ ]]; then
62+ # Commit
63+ echo " 💾 Committing changes..."
64+ git add .
65+ git commit -m " chore: bump version to $NEW_VERSION "
66+
67+ # Tag
68+ echo " 🏷️ Creating tag v$NEW_VERSION ..."
69+ git tag " v$NEW_VERSION "
70+
71+ echo " 🎉 Release $NEW_VERSION is ready!"
72+ echo " "
73+ echo " 📤 To publish:"
74+ echo " git push origin main --tags"
75+ echo " "
76+ echo " 🤖 GitHub Actions will automatically:"
77+ echo " • Build the app"
78+ echo " • Create the release"
79+ echo " • Generate OTA updates"
80+ else
81+ echo " ❌ Canceled. You can undo changes with: git checkout ."
82+ fi
0 commit comments