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