build: correggi firma APK release non-interattiva
- Valida BITEPLAN_KEYSTORE_PASS prima della build e stampa istruzioni chiare - Passa --ks-pass a apksigner tramite env var (stdin era chiuso nel container) - Aggiunge rm -f su biteplan-aligned.apk prima di zipalign per evitare errori su run consecutive - Documenta export BITEPLAN_KEYSTORE_PASS nel docker/README.md Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+14
-1
@@ -62,7 +62,16 @@ keytool -genkey -v \
|
|||||||
> `docker/biteplan.jks` è in `.gitignore` e non verrà mai committato.
|
> `docker/biteplan.jks` è in `.gitignore` e non verrà mai committato.
|
||||||
> Conservalo in un posto sicuro: senza di esso non puoi pubblicare aggiornamenti.
|
> Conservalo in un posto sicuro: senza di esso non puoi pubblicare aggiornamenti.
|
||||||
|
|
||||||
**2. Esegui la build release**
|
**2. Esporta la password del keystore**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export BITEPLAN_KEYSTORE_PASS=tuapassword
|
||||||
|
```
|
||||||
|
|
||||||
|
La variabile è richiesta ad ogni sessione di terminale. Per non doverla riscrivere ogni volta,
|
||||||
|
aggiungila a `~/.bashrc` o `~/.zshrc`.
|
||||||
|
|
||||||
|
**3. Esegui la build release**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bash docker/build/build.sh --release
|
bash docker/build/build.sh --release
|
||||||
@@ -72,6 +81,10 @@ bash docker/build/build.sh --release
|
|||||||
Il keystore viene montato nel container come volume read-only e non viene mai copiato
|
Il keystore viene montato nel container come volume read-only e non viene mai copiato
|
||||||
nell'immagine Docker.
|
nell'immagine Docker.
|
||||||
|
|
||||||
|
> Se la build fallisce con `Output file '…/biteplan-aligned.apk' exists`, esegui
|
||||||
|
> `rm dist/biteplan-aligned.apk` e rilancia. Lo script rimuove il file automaticamente
|
||||||
|
> nelle versioni aggiornate, ma eventuali run interrotte possono lasciarlo indietro.
|
||||||
|
|
||||||
> Prima esecuzione: scarica Flutter SDK + Android SDK (~1-2 GB), richiede 10-15 minuti.
|
> Prima esecuzione: scarica Flutter SDK + Android SDK (~1-2 GB), richiede 10-15 minuti.
|
||||||
|
|
||||||
### Installazione sul dispositivo
|
### Installazione sul dispositivo
|
||||||
|
|||||||
+13
-4
@@ -29,6 +29,12 @@ fi
|
|||||||
mkdir -p "${PROJECT_ROOT}/dist"
|
mkdir -p "${PROJECT_ROOT}/dist"
|
||||||
|
|
||||||
if [[ "$RELEASE" == "true" ]]; then
|
if [[ "$RELEASE" == "true" ]]; then
|
||||||
|
if [[ -z "${BITEPLAN_KEYSTORE_PASS}" ]]; then
|
||||||
|
echo "ERRORE: variabile BITEPLAN_KEYSTORE_PASS non impostata"
|
||||||
|
echo "Usa: export BITEPLAN_KEYSTORE_PASS=tuapassword"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
KEYSTORE="${SCRIPT_DIR}/../biteplan.jks"
|
KEYSTORE="${SCRIPT_DIR}/../biteplan.jks"
|
||||||
if [[ ! -f "$KEYSTORE" ]]; then
|
if [[ ! -f "$KEYSTORE" ]]; then
|
||||||
echo "ERRORE: keystore non trovato in docker/biteplan.jks"
|
echo "ERRORE: keystore non trovato in docker/biteplan.jks"
|
||||||
@@ -40,11 +46,12 @@ if [[ "$RELEASE" == "true" ]]; then
|
|||||||
echo "→ Building release APK..."
|
echo "→ Building release APK..."
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-v "${PROJECT_ROOT}:/workspace" \
|
-v "${PROJECT_ROOT}:/workspace" \
|
||||||
-v "${HOME}/.gradle:/root/.gradle" \
|
-v "gradle-cache:/root/.gradle" \
|
||||||
biteplan-build \
|
biteplan-build \
|
||||||
bash -c "cd /workspace && flutter pub get && flutter pub run flutter_launcher_icons && flutter build apk --release"
|
bash -c "cd /workspace && flutter pub get --enforce-lockfile && flutter pub run flutter_launcher_icons && flutter build apk --release"
|
||||||
|
|
||||||
echo "→ Zipalign..."
|
echo "→ Zipalign..."
|
||||||
|
rm -f "${PROJECT_ROOT}/dist/biteplan-aligned.apk"
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-v "${PROJECT_ROOT}:/workspace" \
|
-v "${PROJECT_ROOT}:/workspace" \
|
||||||
biteplan-build \
|
biteplan-build \
|
||||||
@@ -56,9 +63,11 @@ if [[ "$RELEASE" == "true" ]]; then
|
|||||||
docker run --rm \
|
docker run --rm \
|
||||||
-v "${PROJECT_ROOT}:/workspace" \
|
-v "${PROJECT_ROOT}:/workspace" \
|
||||||
-v "$(realpath "${KEYSTORE%/*}"):/keystore:ro" \
|
-v "$(realpath "${KEYSTORE%/*}"):/keystore:ro" \
|
||||||
|
-e BITEPLAN_KEYSTORE_PASS \
|
||||||
biteplan-build \
|
biteplan-build \
|
||||||
bash -c "apksigner sign \
|
bash -c "apksigner sign \
|
||||||
--ks /keystore/biteplan.jks \
|
--ks /keystore/biteplan.jks \
|
||||||
|
--ks-pass \"pass:\${BITEPLAN_KEYSTORE_PASS}\" \
|
||||||
--out /workspace/dist/biteplan-release.apk \
|
--out /workspace/dist/biteplan-release.apk \
|
||||||
/workspace/dist/biteplan-aligned.apk && \
|
/workspace/dist/biteplan-aligned.apk && \
|
||||||
rm -f /workspace/dist/biteplan-aligned.apk && \
|
rm -f /workspace/dist/biteplan-aligned.apk && \
|
||||||
@@ -71,9 +80,9 @@ else
|
|||||||
echo "→ Building debug APK..."
|
echo "→ Building debug APK..."
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-v "${PROJECT_ROOT}:/workspace" \
|
-v "${PROJECT_ROOT}:/workspace" \
|
||||||
-v "${HOME}/.gradle:/root/.gradle" \
|
-v "gradle-cache:/root/.gradle" \
|
||||||
biteplan-build \
|
biteplan-build \
|
||||||
bash -c "cd /workspace && flutter pub get && flutter pub run flutter_launcher_icons && flutter build apk --debug"
|
bash -c "cd /workspace && flutter pub get --enforce-lockfile && flutter pub run flutter_launcher_icons && flutter build apk --debug"
|
||||||
|
|
||||||
cp "${PROJECT_ROOT}/build/app/outputs/flutter-apk/app-debug.apk" \
|
cp "${PROJECT_ROOT}/build/app/outputs/flutter-apk/app-debug.apk" \
|
||||||
"${PROJECT_ROOT}/dist/biteplan-debug.apk"
|
"${PROJECT_ROOT}/dist/biteplan-debug.apk"
|
||||||
|
|||||||
Reference in New Issue
Block a user