1+ #! /bin/bash
2+ # Voice2Text AI - Flatpak Build and Release Script
3+ # Run this script to build and prepare the flatpak for distribution
4+
5+ set -e # Exit on any error
6+
7+ echo " 🎯 Voice2Text AI - Flatpak Builder"
8+ echo " =================================="
9+
10+ # Colors for output
11+ RED=' \033[0;31m'
12+ GREEN=' \033[0;32m'
13+ YELLOW=' \033[1;33m'
14+ NC=' \033[0m' # No Color
15+
16+ # Function to print colored output
17+ print_status () {
18+ echo -e " ${GREEN} ✅ $1 ${NC} "
19+ }
20+
21+ print_warning () {
22+ echo -e " ${YELLOW} ⚠️ $1 ${NC} "
23+ }
24+
25+ print_error () {
26+ echo -e " ${RED} ❌ $1 ${NC} "
27+ }
28+
29+ # Check if we're in the right directory
30+ if [ ! -f " com.voice2text.app.yml" ]; then
31+ print_error " com.voice2text.app.yml not found. Please run this script from the Voice2Text-AI directory."
32+ exit 1
33+ fi
34+
35+ # Check if flatpak-builder is installed
36+ if ! command -v flatpak-builder & > /dev/null; then
37+ print_warning " flatpak-builder not found. Installing..."
38+ sudo apt update && sudo apt install -y flatpak-builder
39+ print_status " flatpak-builder installed"
40+ else
41+ print_status " flatpak-builder is available"
42+ fi
43+
44+ # Clean any previous builds
45+ print_status " Cleaning previous builds..."
46+ rm -rf build voice2text.flatpak
47+
48+ # Build the flatpak
49+ print_status " Building Flatpak (this may take several minutes)..."
50+ flatpak-builder --force-clean build com.voice2text.app.yml
51+
52+ # Create distributable bundle
53+ print_status " Creating distributable bundle..."
54+ flatpak build-bundle build voice2text.flatpak com.voice2text.app
55+
56+ # Verify the bundle was created
57+ if [ -f " voice2text.flatpak" ]; then
58+ BUNDLE_SIZE=$( du -h voice2text.flatpak | cut -f1)
59+ print_status " Flatpak bundle created: voice2text.flatpak (${BUNDLE_SIZE} )"
60+ else
61+ print_error " Failed to create flatpak bundle"
62+ exit 1
63+ fi
64+
65+ # Test the bundle locally (optional)
66+ read -p " Do you want to test the flatpak locally? (y/n): " -n 1 -r
67+ echo
68+ if [[ $REPLY =~ ^[Yy]$ ]]; then
69+ print_status " Installing locally for testing..."
70+ flatpak-builder --user --install build com.voice2text.app.yml
71+
72+ print_status " Testing the app..."
73+ timeout 10s flatpak run com.voice2text.app || print_warning " App test completed (timeout expected)"
74+ fi
75+
76+ echo " "
77+ print_status " Flatpak build completed successfully!"
78+ echo " "
79+ echo " 📦 Next steps:"
80+ echo " 1. Create a new GitHub release at: https://github.com/crhy/Voice2Text-AI/releases"
81+ echo " 2. Upload the file: voice2text.flatpak"
82+ echo " 3. Tag: v0.3-flatpak"
83+ echo " 4. Title: Voice2Text AI v0.3 - Linux Flatpak"
84+ echo " 5. Description:"
85+ echo ' ```'
86+ echo " Linux Flatpak distribution of Voice2Text AI."
87+ echo " "
88+ echo " ## Installation"
89+ echo ' ```bash'
90+ echo " # Download voice2text.flatpak from this release"
91+ echo " flatpak install --user voice2text.flatpak"
92+ echo " flatpak run com.voice2text.app"
93+ echo ' ```'
94+ echo ' ```'
95+ echo " "
96+ echo " 6. Publish the release"
97+ echo " 7. Share the download URL with the developer to update README.md"
98+ echo " "
99+ print_status " Build script completed! 🎉"
0 commit comments