Skip to content

Commit 48aa389

Browse files
author
XaresAICoder User
committed
feat: add automated release workflow for Windows builds
Add GitHub Actions workflow that automatically builds and packages the Tauri application when version tags are pushed. The workflow: - Triggers on version tags (v*) - Builds the Rust/Tauri application on Windows - Creates portable packages with executable, documentation, and configuration - Generates ZIP archives for distribution - Includes startup scripts and comprehensive README This enables automated release creation without manual intervention, improving release consistency and developer workflow.
1 parent 44ee4ac commit 48aa389

4 files changed

Lines changed: 470 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
name: Automated Release Build
2+
3+
# Triggers automatically when you push a version tag
4+
on:
5+
push:
6+
tags:
7+
- 'v*' # Triggers on tags like v1.0.0, v1.2.3, etc.
8+
9+
jobs:
10+
build-and-release:
11+
runs-on: windows-latest
12+
timeout-minutes: 30
13+
permissions:
14+
contents: write
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Get version from tag
21+
id: version
22+
run: |
23+
$TAG = "${{ github.ref_name }}"
24+
Write-Host "Tag: $TAG"
25+
echo "VERSION=$TAG" >> $env:GITHUB_OUTPUT
26+
shell: pwsh
27+
28+
- name: Setup Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: '20'
32+
33+
- name: Setup Rust
34+
uses: dtolnay/rust-toolchain@stable
35+
with:
36+
toolchain: stable
37+
38+
- name: Rust cache
39+
uses: Swatinem/rust-cache@v2
40+
with:
41+
workspaces: visolingua-rust/src-tauri
42+
cache-on-failure: false
43+
44+
- name: Install npm dependencies
45+
working-directory: visolingua-rust
46+
run: npm install
47+
48+
- name: Build Tauri application
49+
working-directory: visolingua-rust
50+
run: npm run tauri build
51+
52+
- name: Verify build
53+
working-directory: visolingua-rust
54+
run: |
55+
if (Test-Path "src-tauri/target/release/visolingua.exe") {
56+
Write-Host "✅ Build successful!"
57+
$size = (Get-Item "src-tauri/target/release/visolingua.exe").Length / 1MB
58+
Write-Host "📏 Binary size: $($size.ToString('F1')) MB"
59+
} else {
60+
Write-Host "❌ Build failed - executable not found"
61+
exit 1
62+
}
63+
64+
- name: Create portable package
65+
working-directory: visolingua-rust
66+
run: |
67+
# Create portable directory
68+
$portableDir = "VisoLingua-Windows-${{ steps.version.outputs.VERSION }}"
69+
New-Item -ItemType Directory -Path $portableDir -Force
70+
71+
# Copy files
72+
Copy-Item "src-tauri/target/release/visolingua.exe" "$portableDir/"
73+
Copy-Item "README.md" "$portableDir/" -ErrorAction SilentlyContinue
74+
Copy-Item "SETUP.md" "$portableDir/" -ErrorAction SilentlyContinue
75+
76+
# Create config template
77+
$configDir = "$portableDir/config"
78+
New-Item -ItemType Directory -Path $configDir -Force
79+
80+
@"
81+
# VisoLingua Configuration
82+
# Edit this file with your API keys
83+
84+
[llm]
85+
provider = "gemini" # Options: gemini, openai, ollama
86+
gemini_model = "gemini-2.0-flash-exp"
87+
openai_model = "gpt-4o-mini"
88+
ollama_url = "http://localhost:11434"
89+
ollama_model = "llava"
90+
91+
[api_keys]
92+
gemini = "" # Get from: https://aistudio.google.com/
93+
openai = "" # Get from: https://platform.openai.com/
94+
95+
[translation]
96+
target_language = "German"
97+
98+
[ui]
99+
overlay_transparency = "0.3"
100+
"@ | Out-File -FilePath "$configDir/config_sample.toml" -Encoding UTF8
101+
102+
# Create launcher script
103+
@"
104+
@echo off
105+
echo Starting VisoLingua ${{ steps.version.outputs.VERSION }}...
106+
echo.
107+
echo Configuration file location:
108+
echo %APPDATA%\visolingua\config.toml
109+
echo.
110+
111+
REM Check if config exists
112+
if not exist "%APPDATA%\visolingua\config.toml" (
113+
echo First run detected - creating default config...
114+
mkdir "%APPDATA%\visolingua" 2>nul
115+
copy "config\config_sample.toml" "%APPDATA%\visolingua\config.toml"
116+
echo.
117+
echo IMPORTANT: Edit the config file and add your API keys:
118+
echo %APPDATA%\visolingua\config.toml
119+
echo.
120+
pause
121+
)
122+
123+
start "" visolingua.exe
124+
"@ | Out-File -FilePath "$portableDir/Start-VisoLingua.bat" -Encoding ASCII
125+
126+
# Create README
127+
@"
128+
# VisoLingua ${{ steps.version.outputs.VERSION }} - Windows Edition
129+
130+
## Quick Start
131+
132+
1. Run "Start-VisoLingua.bat"
133+
2. On first run, edit the config file and add your API key
134+
3. Save and restart
135+
136+
## Configuration
137+
138+
Config file: %APPDATA%\visolingua\config.toml
139+
140+
Get API keys:
141+
- Gemini (Free): https://aistudio.google.com/
142+
- OpenAI (Paid): https://platform.openai.com/
143+
144+
## Usage
145+
146+
1. Position the red overlay window over text
147+
2. Click inside to capture and translate
148+
3. View results in the popup window
149+
4. Use "Ask AI" for follow-up questions
150+
151+
## Requirements
152+
153+
- Windows 10 or later
154+
- WebView2 Runtime (pre-installed on Windows 11)
155+
156+
If WebView2 is missing:
157+
https://go.microsoft.com/fwlink/p/?LinkId=2124703
158+
159+
## Version Information
160+
161+
- Version: ${{ steps.version.outputs.VERSION }}
162+
- Binary size: ~8-10 MB
163+
- Built with: Rust + Tauri
164+
"@ | Out-File -FilePath "$portableDir/README.txt" -Encoding UTF8
165+
166+
Write-Host "✅ Portable package created: $portableDir"
167+
168+
- name: Create ZIP archive
169+
working-directory: visolingua-rust
170+
run: |
171+
$zipName = "VisoLingua-Windows-${{ steps.version.outputs.VERSION }}.zip"
172+
Compress-Archive -Path "VisoLingua-Windows-${{ steps.version.outputs.VERSION }}" -DestinationPath $zipName
173+
$size = (Get-Item $zipName).Length / 1MB
174+
Write-Host "✅ ZIP created: $zipName ($($size.ToString('F1')) MB)"
175+
echo "ZIP_NAME=$zipName" >> $env:GITHUB_OUTPUT
176+
id: zip
177+
178+
- name: Create GitHub Release
179+
uses: softprops/action-gh-release@v2
180+
with:
181+
tag_name: ${{ steps.version.outputs.VERSION }}
182+
name: VisoLingua ${{ steps.version.outputs.VERSION }}
183+
draft: false
184+
prerelease: ${{ contains(steps.version.outputs.VERSION, '-') }}
185+
body: |
186+
# VisoLingua ${{ steps.version.outputs.VERSION }}
187+
188+
## 🚀 Native Rust + Tauri Version
189+
190+
### ✨ Features:
191+
- 📸 **Transparent overlay** - Position over any text
192+
- 🌏 **Multi-language translation** - Optimized for Chinese
193+
- 🤖 **Ask AI** - Ask follow-up questions about translations
194+
- 💾 **Translation history** - Review past translations
195+
- ⚙️ **LLM support** - Gemini, OpenAI, or local Ollama
196+
197+
### 🎯 Advantages over Python version:
198+
- **80% smaller** (~8 MB vs ~50 MB)
199+
- **Native performance** - No Python runtime needed
200+
- **No antivirus issues** - Native compilation
201+
- **Faster startup** - ~0.5s vs 2-3s
202+
203+
### 📦 Download:
204+
- **VisoLingua-Windows-${{ steps.version.outputs.VERSION }}.zip** - Complete portable package (recommended)
205+
- **visolingua.exe** - Standalone binary only
206+
207+
### 🔧 Quick Setup:
208+
1. Download and extract ZIP
209+
2. Run `Start-VisoLingua.bat`
210+
3. Add your API key when prompted
211+
4. Start translating!
212+
213+
### 📋 Requirements:
214+
- Windows 10 or later
215+
- WebView2 Runtime (pre-installed on Windows 11)
216+
217+
### 🔑 Get API Keys (Free):
218+
- **Gemini**: https://aistudio.google.com/
219+
- **OpenAI**: https://platform.openai.com/
220+
221+
---
222+
223+
**Note**: The Go version is experimental and not recommended. Use Rust or Python versions.
224+
files: |
225+
visolingua-rust/VisoLingua-Windows-${{ steps.version.outputs.VERSION }}.zip
226+
visolingua-rust/src-tauri/target/release/visolingua.exe
227+
env:
228+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
229+
230+
- name: Upload build artifacts
231+
uses: actions/upload-artifact@v4
232+
with:
233+
name: VisoLingua-${{ steps.version.outputs.VERSION }}-artifacts
234+
path: |
235+
visolingua-rust/VisoLingua-Windows-${{ steps.version.outputs.VERSION }}.zip
236+
visolingua-rust/src-tauri/target/release/visolingua.exe
237+
retention-days: 90

IMPLEMENTATION_COMPARISON.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,20 +161,28 @@ build/bin/
161161

162162
## GitHub Actions CI/CD
163163

164-
Both Rust and Python have GitHub Actions workflows:
164+
All versions have GitHub Actions workflows:
165165

166-
**Python:**
166+
**Automated Releases (All Versions):**
167+
- File: `.github/workflows/release.yml`
168+
- Trigger: **Automatic on version tags** (e.g., `v1.0.0`)
169+
- Output: GitHub Release with ZIP + binaries
170+
- Usage: `git tag v1.0.0 && git push origin v1.0.0`
171+
172+
**Python (Manual):**
167173
- File: `.github/workflows/build-release.yml`
168174
- Trigger: Manual only
169175
- Output: PyInstaller .exe
170176

171-
**Rust:**
177+
**Rust (Manual):**
172178
- File: `.github/workflows/build-rust-windows.yml`
173179
- Trigger: Manual only
174180
- Output: Native .exe + MSI installer
175181

176-
**Go:**
177-
- Not yet implemented (can add if needed)
182+
**Go (Manual):**
183+
- File: `.github/workflows/build-go-windows.yml`
184+
- Trigger: Manual only
185+
- Output: Wails .exe (not working - screen capture issue)
178186

179187
## Next Steps
180188

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ VisoLingua is available in **three implementations** with different trade-offs:
1919
| Version | Status | Binary Size | Startup | Best For | Link |
2020
|---------|--------|-------------|---------|----------|------|
2121
| **🐍 Python** |**Working** | ~50 MB | ~2-3s | Development, quick iteration | *(this directory)* |
22-
| **🦀 Rust** |**Working** | **~8 MB** | **~0.5s** | **Production use**| [visolingua-rust/](visolingua-rust/) |
22+
| **🦀 Rust** |**Working** | **~8 MB** | **~0.5s** | **Production use**| [visolingua-rust/](visolingua-rust/) [Releases](../../releases) |
2323
| **🐹 Go** | ⚠️ **Broken** | ~12 MB | ~1s | Not recommended | [visolingua-go/](visolingua-go/) |
2424

25+
### 📦 Download Pre-built Binaries
26+
27+
**[→ Download Latest Release](../../releases/latest)** - Get the Rust version (recommended)
28+
2529
### Quick Recommendations
2630

2731
- **🎯 For end users**: Use the **[Rust version](visolingua-rust/)** - smallest, fastest, most reliable

0 commit comments

Comments
 (0)