1- # Build y release al pushear un tag de versión.
2- #
3- # Flujo recomendado:
4- # 1. Asegúrate de que package.json, src-tauri/Cargo.toml y
5- # src-tauri/tauri.conf.json tienen la misma versión semver.
6- # 2. Crea y pushea el tag:
7- # git tag v1.0.0 && git push origin v1.0.0
8- # 3. El workflow valida versiones, compila, firma (si hay claves) y crea el release.
9- #
10- # Secrets opcionales para firmar y activar el auto-updater:
11- # - TAURI_SIGNING_PRIVATE_KEY → clave privada en base64
12- # - TAURI_SIGNING_PRIVATE_KEY_PASSWORD → contraseña de la clave
13- #
14- # Sin esos secrets el build funciona pero el auto-updater no estará disponible.
15-
16- name : Build and Release — Windows
1+ name : Release Windows
172
183on :
194 push :
238 workflow_dispatch :
249 inputs :
2510 draft :
26- description : ' Crear como borrador ( draft) '
11+ description : ' Crear release como draft'
2712 type : boolean
2813 default : true
2914 prerelease :
30- description : ' Marcar como pre-release '
15+ description : ' Marcar release como prerelease '
3116 type : boolean
3217 default : false
3318
34- # En releases NO cancelamos: un release a medias sería peor que dejarlo terminar.
3519concurrency :
3620 group : release-${{ github.ref }}
3721 cancel-in-progress : false
3822
3923jobs :
40- release-windows :
41- name : Release — Windows x64
24+ release :
25+ name : Build + Release ( Windows x64)
4226 runs-on : windows-latest
4327 permissions :
4428 contents : write
4529
4630 steps :
47- # ─── 1. CHECKOUT ────────────────────────────────────────────────────────
4831 - name : Checkout repository
4932 uses : actions/checkout@v4
5033
51- # ─── 2. EXTRAER VERSIÓN DEL TAG ─────────────────────────────────────────
5234 - name : Extract version from tag
5335 id : version
5436 shell : pwsh
5537 run : |
56- $tag = "${{ github.ref_name }}"
38+ $tag = "${{ github.ref_name }}"
5739 $version = $tag -replace '^v', ''
58- Write-Host "Tag: $tag → Version: $version"
59- "tag=$tag" >> $env:GITHUB_OUTPUT
40+ "tag=$tag" >> $env:GITHUB_OUTPUT
6041 "version=$version" >> $env:GITHUB_OUTPUT
6142
62- # ─── 3. VALIDAR VERSIONES ───────────────────────────────────────────────
6343 - name : Validate version consistency
6444 shell : pwsh
6545 run : |
66- $cargoRaw = Get-Content src-tauri/Cargo.toml -Raw
67- $pkgRaw = Get-Content package.json -Raw
68- $tauriRaw = Get-Content src-tauri/tauri.conf.json -Raw
69-
70- $cargoVer = [regex]::Match($cargoRaw, '(?m)^version\s*=\s*"([^"]+)"').Groups[1].Value
71- $pkgVer = ($pkgRaw | ConvertFrom-Json).version
72- $tauriVer = ($tauriRaw | ConvertFrom-Json).package.version
73- $tagVer = "${{ steps.version.outputs.version }}"
74-
75- Write-Host "Cargo.toml: $cargoVer"
76- Write-Host "package.json: $pkgVer"
77- Write-Host "tauri.conf.json: $tauriVer"
78- Write-Host "Tag: $tagVer"
46+ $cargoRaw = Get-Content src-tauri/Cargo.toml -Raw
47+ $pkgRaw = Get-Content package.json -Raw
48+ $tauriRaw = Get-Content src-tauri/tauri.conf.json -Raw
7949
80- $errors = 0
81- if ($cargoVer -ne $ pkgVer) { Write-Error "Mismatch: Cargo ($cargoVer) != package.json ($pkgVer)"; $errors++ }
82- if ($cargoVer -ne $ tauriVer) { Write-Error "Mismatch: Cargo ($cargoVer) != tauri.conf.json ($tauriVer)"; $errors++ }
83- if ($cargoVer -ne $ tagVer) { Write-Error "Mismatch: Cargo ($cargoVer) != tag ($tagVer)"; $errors++ }
50+ $cargoVer = [regex]::Match($cargoRaw, '(?m)^version\s*=\s*"([^"]+)"').Groups[1].Value
51+ $ pkgVer = ($pkgRaw | ConvertFrom-Json).version
52+ $ tauriVer = ($tauriRaw | ConvertFrom-Json).package.version
53+ $ tagVer = "${{ steps.version.outputs.version }}"
8454
85- if ($errors -gt 0) { exit 1 }
86- Write-Host "✅ All versions match: $cargoVer"
87- CARGO_VERSION=$(grep -E '^version\s*=' src-tauri/Cargo.toml | head -1 | sed -E 's/.*"([^"]+)".*/\1/' | tr -d ' ')
88- PACKAGE_VERSION=$(grep -E '"version"' package.json | head -1 | sed -E 's/.*"([^"]+)".*/\1/' | tr -d ' ')
89- TAURI_CONF_VERSION=$(grep -E '"version"' src-tauri/tauri.conf.json | head -1 | sed -E 's/.*"([^"]+)".*/\1/' | tr -d ' ')
90- TAG_VERSION="${{ steps.version.outputs.version }}"
91-
92- echo "Cargo.toml version: $CARGO_VERSION"
93- echo "package.json version: $PACKAGE_VERSION"
94- echo "tauri.conf.json version: $TAURI_CONF_VERSION"
95- echo "Tag version: $TAG_VERSION"
96-
97- if [ "$CARGO_VERSION" != "$PACKAGE_VERSION" ]; then
98- echo "❌ ERROR: Version mismatch between Cargo.toml and package.json!"
99- echo " Cargo.toml: $CARGO_VERSION"
100- echo " package.json: $PACKAGE_VERSION"
101- exit 1
102- fi
55+ if ($cargoVer -ne $pkgVer) { Write-Error "Cargo.toml != package.json"; exit 1 }
56+ if ($cargoVer -ne $tauriVer) { Write-Error "Cargo.toml != tauri.conf.json"; exit 1 }
57+ if ($cargoVer -ne $tagVer) { Write-Error "Cargo.toml != tag"; exit 1 }
10358
104- if [ "$CARGO_VERSION" != "$TAURI_CONF_VERSION" ]; then
105- echo "❌ ERROR: Version mismatch between Cargo.toml and src-tauri/tauri.conf.json!"
106- echo " Cargo.toml: $CARGO_VERSION"
107- echo " tauri.conf.json: $TAURI_CONF_VERSION"
108- exit 1
109- fi
110-
111- if [ "$CARGO_VERSION" != "$TAG_VERSION" ]; then
112- echo "❌ ERROR: Tag version does not match Cargo.toml version!"
113- echo " Tag: $TAG_VERSION"
114- echo " Cargo.toml: $CARGO_VERSION"
115- exit 1
116- fi
117-
118- echo "✅ All versions match: $CARGO_VERSION"
119-
120- # ─── 4. TOOLCHAIN — NODE + PNPM ─────────────────────────────────────────
121- - name : Setup Node.js 20 LTS
59+ - name : Setup Node.js
12260 uses : actions/setup-node@v4
12361 with :
12462 node-version : ' 20'
@@ -136,13 +74,12 @@ jobs:
13674 restore-keys : |
13775 windows-pnpm-
13876
139- # ─── 5. TOOLCHAIN — RUST ────────────────────────────────────────────────
140- - name : Setup Rust stable (x86_64-pc-windows-msvc)
77+ - name : Setup Rust
14178 uses : dtolnay/rust-toolchain@stable
14279 with :
14380 targets : x86_64-pc-windows-msvc
14481
145- - name : Cache Cargo registry + build artifacts
82+ - name : Cache Cargo
14683 uses : actions/cache@v4
14784 with :
14885 path : |
@@ -154,179 +91,45 @@ jobs:
15491 windows-cargo-release-
15592 windows-cargo-
15693
157- # ─── 6. VERIFICAR ACTIVOS NECESARIOS ────────────────────────────────────
158- - name : Verify required Windows icons
159- shell : pwsh
160- run : |
161- $icons = @(
162- "src-tauri/icons/icon.ico",
163- "src-tauri/icons/32x32.png",
164- "src-tauri/icons/128x128.png"
165- )
166- foreach ($icon in $icons) {
167- if (Test-Path $icon) { Write-Host "✓ $icon" }
168- else { Write-Error "✗ Missing: $icon"; exit 1 }
169- }
170-
171- # ─── 7. COMPROBAR CLAVES DE FIRMA ───────────────────────────────────────
172- - name : Check signing keys availability
173- id : signing
174- shell : pwsh
175- run : |
176- $hasKey = "${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}" -ne ""
177- $hasPwd = "${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}" -ne ""
178- $canSign = $hasKey -and $hasPwd
179-
180- if ($canSign) {
181- Write-Host "✅ Signing keys present — build will be signed and auto-updater will work."
182- "enabled=true" >> $env:GITHUB_OUTPUT
183- } else {
184- Write-Host "⚠️ Signing keys missing — build will work but auto-updater will NOT be available."
185- Write-Host " TAURI_SIGNING_PRIVATE_KEY: $(if ($hasKey) { 'present' } else { 'MISSING' })"
186- Write-Host " TAURI_SIGNING_PRIVATE_KEY_PASSWORD: $(if ($hasPwd) { 'present' } else { 'MISSING' })"
187- "enabled=false" >> $env:GITHUB_OUTPUT
188- }
189-
190- # ─── 8. FRONTEND ────────────────────────────────────────────────────────
19194 - name : Install frontend dependencies
19295 run : pnpm install --frozen-lockfile
19396
19497 - name : Build frontend
19598 run : pnpm build
19699
197- <<<<<<< HEAD
198- - name : Build Tauri app
199- id : build_tauri
200- uses : tauri-apps/tauri-action@v0
201- env :
202- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
203- with :
204- projectPath : .
205- args : --target ${{ matrix.target }}
206- tagName : ${{ github.ref_name }}
207- releaseName : ' MeaCode Studio ${{ github.ref_name }}'
208- releaseBody : |
209- ## MeaCode Studio ${{ github.ref_name }}
210- =======
211- # ─── 9. BUILD TAURI + CREAR RELEASE ─────────────────────────────────────
212- - name : Build Tauri app and publish release
213- id : tauri_build
100+ - name : Build and publish release
214101 uses : tauri-apps/tauri-action@v0
215102 env :
216103 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
217- TAURI_SIGNING_PRIVATE_KEY : ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
218- TAURI_SIGNING_PRIVATE_KEY_PASSWORD : ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
219104 with :
220105 projectPath : .
221106 args : --target x86_64-pc-windows-msvc
222107 tagName : ${{ steps.version.outputs.tag }}
223108 releaseName : ' MeaCode Studio ${{ steps.version.outputs.tag }}'
224109 releaseBody : |
225110 ## MeaCode Studio ${{ steps.version.outputs.tag }}
226- >>>>>>> bb16f29d0d784dce49612e99b19e3a77c8e98040
227-
228- ${{ steps.signing.outputs.enabled != 'true' && '> ⚠️ **Unsigned build** — el auto-updater no está disponible en esta versión. La instalación manual funciona correctamente.' || '' }}
229-
230- # ## ✨ Características
231- - 🚀 IDE IA-first con acciones contextuales sobre código
232- - 💬 Chat IA integrado (Nexusify API)
233- - 📝 Editor Monaco con soporte LSP
234- - 🖥️ Terminal integrada (xterm.js)
235- - 📁 Explorador de archivos
236- - 🔍 Búsqueda rápida (`Ctrl+P`)
237- - ⌨️ Command Palette (`Ctrl+Shift+P`)
238- - 💾 Persistencia de sesión entre reinicios
239111
240- # ## 🎯 Acciones IA sobre código
241- - **Explain this** — explica el código seleccionado
242- - **Fix error** — corrige errores automáticamente
243- - **Refactor** — mejora el código manteniendo su funcionalidad
244-
245- # ## 📦 Instalación Windows
246- Descarga el archivo `.exe` (instalador NSIS) o `.msi` y ejecútalo.
247- Windows puede mostrar una advertencia SmartScreen — haz clic en **"Más información → Ejecutar de todas formas"**.
248-
249- Más información en el [README](https://github.com/${{ github.repository }}/blob/main/README.md).
112+ Build oficial para Windows x64.
113+ Incluye instalador `.exe` (NSIS) y `.msi`.
250114 releaseDraft : ${{ github.event.inputs.draft != 'false' }}
251115 prerelease : ${{ github.event.inputs.prerelease == 'true' }}
252116
253- # ─── 10. VERIFICAR BINARIO Y REPORTAR TAMAÑO ────────────────────────────
254- - name : Verify binary and report artifact sizes
255- shell : pwsh
256- run : |
257- $binaryPath = "src-tauri\target\x86_64-pc-windows-msvc\release\meacode-studio.exe"
258- if (Test-Path $binaryPath) {
259- $sizeMB = [math]::Round((Get-Item $binaryPath).Length / 1MB, 2)
260- Write-Host "✅ meacode-studio.exe ($sizeMB MB)"
261- } else {
262- Write-Error "❌ Binary not found: $binaryPath"
263- exit 1
264- }
265-
266- $bundleDir = "src-tauri\target\x86_64-pc-windows-msvc\release\bundle"
267- if (Test-Path $bundleDir) {
268- Write-Host ""
269- Write-Host "Bundle artifacts:"
270- Get-ChildItem $bundleDir -Recurse -File | ForEach-Object {
271- $sizeMB = [math]::Round($_.Length / 1MB, 2)
272- Write-Host " $($_.Name) ($sizeMB MB)"
273- }
274- }
275-
276- # ─── 11. GENERAR CHECKSUMS SHA-256 ──────────────────────────────────────
277- - name : Generate SHA-256 checksums
117+ - name : Generate checksums
278118 shell : pwsh
279119 run : |
280120 $bundleDir = "src-tauri\target\x86_64-pc-windows-msvc\release\bundle"
281- $outDir = "checksums"
121+ $outDir = "checksums"
282122 New-Item -ItemType Directory -Force -Path $outDir | Out-Null
283-
284- $extensions = @("*.exe", "*.msi", "*.zip", "*.nsis.zip")
285- $files = Get-ChildItem $bundleDir -Recurse -Include $extensions -File
286-
287- if ($files.Count -eq 0) {
288- Write-Host "⚠️ No bundle files found for checksums."
289- } else {
290- $allChecksums = @()
291- foreach ($file in $files) {
292- $hash = (Get-FileHash $file.FullName -Algorithm SHA256).Hash.ToLower()
293- $line = "$hash $($file.Name)"
294- $allChecksums += $line
295- Write-Host " $line"
296- }
297- $allChecksums | Set-Content "$outDir\checksums-windows-x64.sha256"
298- Write-Host ""
299- Write-Host "✅ Checksums written to $outDir\checksums-windows-x64.sha256"
123+ $files = Get-ChildItem $bundleDir -Recurse -Include *.exe,*.msi,*.zip -File
124+ foreach ($file in $files) {
125+ $hash = (Get-FileHash $file.FullName -Algorithm SHA256).Hash.ToLower()
126+ "$hash $($file.Name)" | Add-Content "$outDir\checksums-windows-x64.sha256"
300127 }
301128
302- # ─── 12. SUBIR ARTEFACTOS ───────────────────────────────────────────────
303- - name : Upload Windows installers as artifacts
304- if : success()
305- uses : actions/upload-artifact@v4
306- with :
307- name : MeaCode-Studio-${{ steps.version.outputs.version }}-windows-x64
308- path : |
309- src-tauri\target\x86_64-pc-windows-msvc\release\bundle\nsis\*.exe
310- src-tauri\target\x86_64-pc-windows-msvc\release\bundle\msi\*.msi
311- retention-days : 90
312- if-no-files-found : warn
313-
314- - name : Upload checksums as artifact
315- if : success() && hashFiles('checksums/**') != ''
129+ - name : Upload checksums artifact
130+ if : hashFiles('checksums/**') != ''
316131 uses : actions/upload-artifact@v4
317132 with :
318133 name : checksums-${{ steps.version.outputs.version }}-windows-x64
319134 path : checksums\
320135 retention-days : 90
321-
322- # ─── 13. LOGS EN CASO DE FALLO ──────────────────────────────────────────
323- - name : Upload build logs on failure
324- if : failure()
325- uses : actions/upload-artifact@v4
326- with :
327- name : build-logs-release-windows-${{ github.run_number }}
328- path : |
329- src-tauri\target\**\*.log
330- src-tauri\target\**\build.log
331- retention-days : 14
332- if-no-files-found : ignore
0 commit comments