Skip to content

Commit f917ed6

Browse files
committed
Add signing guide and improve CI workflows
Added a detailed signing guide for Tauri in .github/docs. Enhanced build and release workflows with version consistency checks, binary verification, checksum generation, and improved handling of signing keys. Introduced a new test workflow for multi-platform CI testing. Updated nightly workflow to support dynamic tag naming.
1 parent aa94694 commit f917ed6

5 files changed

Lines changed: 537 additions & 7 deletions

File tree

.github/docs/signing-guide.md

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
# Guía de Firma de Binarios para Tauri
2+
3+
Esta guía explica cómo configurar las claves de firma para habilitar el sistema de auto-actualización de MeaCode Studio.
4+
5+
## ¿Qué son las claves de firma?
6+
7+
Las claves de firma permiten:
8+
-**Firmar binarios** para verificar su autenticidad
9+
-**Habilitar el auto-updater** de Tauri (actualizaciones automáticas)
10+
-**Proteger a los usuarios** contra binarios modificados
11+
12+
**Sin claves de firma:**
13+
- ✅ Los builds funcionan normalmente
14+
- ✅ La instalación manual funciona
15+
- ❌ El auto-updater NO funcionará
16+
- ❌ Los binarios no estarán firmados
17+
18+
## Generación de Claves
19+
20+
### Opción 1: Usando el Script Automatizado (Recomendado)
21+
22+
1. **Ejecuta el script de generación:**
23+
```powershell
24+
.\scripts\generate-keys.ps1
25+
```
26+
27+
2. **El script:**
28+
- Genera la clave privada y pública
29+
- Actualiza `src-tauri/tauri.conf.json` automáticamente
30+
- Crea un archivo `tauri-keys-info.txt` con toda la información
31+
32+
3. **Sigue las instrucciones** que muestra el script para configurar los GitHub Secrets.
33+
34+
### Opción 2: Generación Manual
35+
36+
1. **Navega al directorio de Tauri:**
37+
```bash
38+
cd src-tauri
39+
```
40+
41+
2. **Genera las claves:**
42+
```bash
43+
pnpm tauri signer generate -w ~/.tauri/meacode-studio.key
44+
```
45+
46+
3. **Cuando se te pida:**
47+
- Ingresa una contraseña segura (guárdala, la necesitarás)
48+
- Confirma la contraseña
49+
50+
4. **El comando mostrará:**
51+
- La **clave pública** (publkey) - cópiala
52+
- La ubicación de la **clave privada** (normalmente `~/.tauri/meacode-studio.key`)
53+
54+
5. **Actualiza `src-tauri/tauri.conf.json`:**
55+
```json
56+
{
57+
"tauri": {
58+
"updater": {
59+
"active": true,
60+
"endpoints": [...],
61+
"dialog": true,
62+
"pubkey": "TU_CLAVE_PUBLICA_AQUI"
63+
}
64+
}
65+
}
66+
```
67+
68+
## Configuración de GitHub Secrets
69+
70+
Para que los builds en GitHub Actions usen las claves de firma:
71+
72+
1. **Ve a tu repositorio en GitHub:**
73+
```
74+
https://github.com/TU_USUARIO/TU_REPO/settings/secrets/actions
75+
```
76+
77+
2. **Crea los siguientes secrets:**
78+
79+
| Secret Name | Valor | Descripción |
80+
|------------|-------|-------------|
81+
| `TAURI_SIGNING_PRIVATE_KEY` | Contenido completo del archivo `.key` | La clave privada generada |
82+
| `TAURI_SIGNING_PRIVATE_KEY_PASSWORD` | La contraseña que usaste | La contraseña para desencriptar la clave |
83+
| `TAURI_PRIVATE_KEY` | Mismo que `TAURI_SIGNING_PRIVATE_KEY` | Alias requerido para Windows |
84+
85+
3. **Para obtener la clave privada:**
86+
```bash
87+
# Linux/macOS
88+
cat ~/.tauri/meacode-studio.key
89+
90+
# Windows PowerShell
91+
Get-Content $env:USERPROFILE\.tauri\meacode-studio.key
92+
```
93+
94+
4. **Copia TODO el contenido** del archivo (incluyendo las líneas `-----BEGIN...` y `-----END...`)
95+
96+
## Verificación
97+
98+
Después de configurar los secrets:
99+
100+
1. **Crea un tag de release:**
101+
```bash
102+
git tag v0.1.0
103+
git push origin v0.1.0
104+
```
105+
106+
2. **Revisa el workflow `release.yml`:**
107+
- Debería mostrar: `✅ Signing keys found - builds will be signed`
108+
- Los binarios se firmarán automáticamente
109+
- El auto-updater funcionará
110+
111+
## ¿Qué hacer si no tienes claves?
112+
113+
**No pasa nada.** Los workflows están diseñados para funcionar sin claves:
114+
115+
-**build.yml** - Funciona sin claves (solo verificación)
116+
-**release.yml** - Funciona sin claves (builds sin firma)
117+
- ⚠️ **Auto-updater** - NO funcionará sin claves
118+
119+
### Builds sin firma
120+
121+
Si no configuras las claves:
122+
- Los builds se completarán exitosamente
123+
- Los binarios se generarán normalmente
124+
- La instalación manual funcionará
125+
- El auto-updater estará deshabilitado
126+
127+
El workflow mostrará un warning pero **no fallará**:
128+
```
129+
⚠️ WARNING: Signing keys not found!
130+
⚠️ Build will continue WITHOUT signing:
131+
- Binaries will be built successfully
132+
- Auto-updater will NOT work (requires signed binaries)
133+
- Manual installation will work fine
134+
```
135+
136+
## Troubleshooting
137+
138+
### Error: "incorrect updater private key password"
139+
140+
**Causa:** La contraseña en el GitHub Secret no coincide con la usada para generar la clave.
141+
142+
**Solución:**
143+
1. Verifica que `TAURI_SIGNING_PRIVATE_KEY_PASSWORD` tenga exactamente la misma contraseña
144+
2. O regenera las claves con una contraseña conocida y actualiza ambos secrets
145+
146+
### Error: "A public key has been found, but no private key"
147+
148+
**Causa:** Falta el secret `TAURI_PRIVATE_KEY` (especialmente en Windows).
149+
150+
**Solución:**
151+
1. Crea el secret `TAURI_PRIVATE_KEY` con el mismo valor que `TAURI_SIGNING_PRIVATE_KEY`
152+
153+
### La clave pública no se actualiza automáticamente
154+
155+
**Solución manual:**
156+
1. Ejecuta: `.\scripts\update-pubkey.ps1 -PublicKey "TU_CLAVE_PUBLICA"`
157+
2. O edita manualmente `src-tauri/tauri.conf.json`
158+
159+
## Seguridad
160+
161+
⚠️ **IMPORTANTE:**
162+
-**NUNCA** subas la clave privada al repositorio
163+
-**NUNCA** subas la contraseña al repositorio
164+
- ✅ La clave privada está en `.gitignore`
165+
- ✅ El archivo `tauri-keys-info.txt` está en `.gitignore`
166+
- ✅ Solo usa GitHub Secrets para almacenar las claves
167+
168+
## Referencias
169+
170+
- [Tauri Updater Documentation](https://tauri.app/v1/guides/distribution/updater)
171+
- [Tauri Signer Documentation](https://tauri.app/v1/guides/distribution/signing)

.github/workflows/build.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,24 @@ jobs:
3232
- name: Checkout repository
3333
uses: actions/checkout@v4
3434

35+
- name: Validate version consistency
36+
shell: bash
37+
run: |
38+
CARGO_VERSION=$(grep -E '^version\s*=' src-tauri/Cargo.toml | head -1 | sed -E 's/.*"([^"]+)".*/\1/' | tr -d ' ')
39+
PACKAGE_VERSION=$(grep -E '"version"' package.json | head -1 | sed -E 's/.*"([^"]+)".*/\1/' | tr -d ' ')
40+
41+
echo "Cargo.toml version: $CARGO_VERSION"
42+
echo "package.json version: $PACKAGE_VERSION"
43+
44+
if [ "$CARGO_VERSION" != "$PACKAGE_VERSION" ]; then
45+
echo "❌ ERROR: Version mismatch!"
46+
echo " Cargo.toml: $CARGO_VERSION"
47+
echo " package.json: $PACKAGE_VERSION"
48+
exit 1
49+
fi
50+
51+
echo "✅ Versions match: $CARGO_VERSION"
52+
3553
- name: Setup Node.js
3654
uses: actions/setup-node@v4
3755
with:
@@ -117,12 +135,64 @@ jobs:
117135

118136
- name: Build frontend
119137
run: pnpm build
138+
continue-on-error: true
139+
id: build_frontend
120140

121141
- name: Build Tauri app (check only)
142+
id: build_tauri
122143
uses: tauri-apps/tauri-action@v0
123144
env:
124145
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
125146
with:
126147
projectPath: .
127148
args: --target ${{ matrix.target }}
149+
continue-on-error: true
150+
151+
- name: Verify binaries exist
152+
if: always()
153+
shell: bash
154+
run: |
155+
if [ "${{ steps.build_tauri.outcome }}" != "success" ]; then
156+
echo "⚠️ Build failed, skipping binary verification"
157+
exit 0
158+
fi
159+
160+
if [ "${{ matrix.os }}" == "windows-latest" ]; then
161+
if [ -f "src-tauri/target/${{ matrix.target }}/release/meacode-studio.exe" ]; then
162+
echo "✅ Binary found: meacode-studio.exe"
163+
ls -lh "src-tauri/target/${{ matrix.target }}/release/meacode-studio.exe"
164+
else
165+
echo "❌ ERROR: Binary not found!"
166+
find src-tauri/target/${{ matrix.target }}/release -name "*.exe" -o -name "*.msi" -o -name "*.nsis.zip" || true
167+
exit 1
168+
fi
169+
elif [ "${{ matrix.os }}" == "ubuntu-22.04" ]; then
170+
if [ -f "src-tauri/target/${{ matrix.target }}/release/meacode-studio" ]; then
171+
echo "✅ Binary found: meacode-studio"
172+
ls -lh "src-tauri/target/${{ matrix.target }}/release/meacode-studio"
173+
else
174+
echo "❌ ERROR: Binary not found!"
175+
find src-tauri/target/${{ matrix.target }}/release -name "meacode-studio" -o -name "*.AppImage" -o -name "*.deb" || true
176+
exit 1
177+
fi
178+
elif [ "${{ matrix.os }}" == "macos-latest" ]; then
179+
if [ -d "src-tauri/target/${{ matrix.target }}/release/bundle/macos/MeaCode Studio.app" ]; then
180+
echo "✅ Binary found: MeaCode Studio.app"
181+
ls -lh "src-tauri/target/${{ matrix.target }}/release/bundle/macos/MeaCode Studio.app"
182+
else
183+
echo "❌ ERROR: Binary not found!"
184+
find src-tauri/target/${{ matrix.target }}/release/bundle -name "*.app" -o -name "*.dmg" || true
185+
exit 1
186+
fi
187+
fi
128188
189+
- name: Upload build logs on failure
190+
if: failure()
191+
uses: actions/upload-artifact@v4
192+
with:
193+
name: build-logs-${{ matrix.os }}-${{ matrix.target }}
194+
path: |
195+
src-tauri/target/**/*.log
196+
src-tauri/target/**/build.log
197+
retention-days: 7
198+
if-no-files-found: ignore

.github/workflows/nightly.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@
4040
# - name: Checkout repository
4141
# uses: actions/checkout@v4
4242
#
43+
# - name: Get date for tag
44+
# id: date
45+
# shell: bash
46+
# run: |
47+
# if [ "${{ runner.os }}" == "Windows" ]; then
48+
# DATE=$(powershell -Command "Get-Date -Format 'yyyyMMdd'")
49+
# else
50+
# DATE=$(date +%Y%m%d)
51+
# fi
52+
# echo "date=$DATE" >> $GITHUB_OUTPUT
53+
# echo "Date for tag: $DATE"
54+
#
4355
# - name: Setup Node.js
4456
# uses: actions/setup-node@v4
4557
# with:
@@ -105,13 +117,12 @@
105117
# with:
106118
# projectPath: .
107119
# args: --target ${{ matrix.target }}
108-
# tagName: nightly-$(date +%Y%m%d)
109-
# releaseName: 'MeaCode Studio Nightly $(date +%Y%m%d)'
120+
# tagName: nightly-${{ steps.date.outputs.date }}
121+
# releaseName: 'MeaCode Studio Nightly ${{ steps.date.outputs.date }}'
110122
# releaseBody: |
111123
# ## MeaCode Studio Nightly Build
112124
#
113125
# Build automático del branch main.
114126
# Puede contener características experimentales.
115127
# releaseDraft: true
116128
# prerelease: true
117-

0 commit comments

Comments
 (0)