diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 2407e60..c58c062 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -7,17 +7,22 @@ on: env: PATH: /opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin ANDROID_HOME: /Users/freetlab/Library/Android/sdk + KEYSTORE_PATH: /Users/freetlab/.openclaw/workspace/.secure/pluriwave/pluriwave-upload.jks + KEYSTORE_ALIAS: pluriwave-upload jobs: analizar: name: Análisis de código runs-on: [self-hosted, macos, arm64, flutter] steps: - - uses: actions/checkout@v4 + - name: Clonar repo + run: | + git clone https://ShanaiaBot:${{ secrets.GITEA_TOKEN }}@git.freetimelab.es/FreeTLab/pluriwave.git . + git fetch origin main + - name: Obtener dependencias run: flutter pub get - #- name: Generar l10n - # run: flutter gen-l10n + - name: Analizar código run: flutter analyze --no-fatal-infos --no-fatal-warnings @@ -27,7 +32,24 @@ jobs: needs: analizar if: ${{ gitea.ref == 'refs/heads/main' }} steps: - - uses: actions/checkout@v4 + - name: Clonar repo + run: | + git clone https://ShanaiaBot:${{ secrets.GITEA_TOKEN }}@git.freetimelab.es/FreeTLab/pluriwave.git . + git fetch origin main + + - name: Configurar keystore de firma + env: + KEYSTORE_PASSWORD: ${{ secrets.PLURIWAVE_KEYSTORE_PASSWORD }} + run: | + if [ ! -f "$KEYSTORE_PATH" ]; then + echo "ERROR: Keystore no encontrado en $KEYSTORE_PATH" + exit 1 + fi + echo "storeFile=$KEYSTORE_PATH" > android/key.properties + echo "storePassword=$KEYSTORE_PASSWORD" >> android/key.properties + echo "keyAlias=$KEYSTORE_ALIAS" >> android/key.properties + echo "keyPassword=$KEYSTORE_PASSWORD" >> android/key.properties + echo "✅ Keystore configurado" - name: Bump versión patch + commit run: | @@ -46,7 +68,6 @@ jobs: git add pubspec.yaml git commit -m "chore: bump version to ${NEW_VERSION} [ci skip]" git push origin main - echo "NEW_SEMVER=${MAJOR}.${MINOR}.${NEW_PATCH}" >> $GITHUB_ENV - name: Extraer versión id: version @@ -59,15 +80,17 @@ jobs: - name: Obtener dependencias run: flutter pub get - #- name: Generar l10n - # run: flutter gen-l10n - - name: Build APK release run: flutter build apk --release - name: Build AAB release run: flutter build appbundle --release + - name: Verificar firma + run: | + echo "=== Huellas del keystore ===" + keytool -list -v -keystore "$KEYSTORE_PATH" -alias $KEYSTORE_ALIAS -storepass "$KEYSTORE_PASSWORD" 2>/dev/null | grep "SHA1:\|SHA256:" || echo "OK" + - name: Publicar en ftl-builds (Zimaboard) run: | VERSION="${{ steps.version.outputs.version }}" @@ -94,9 +117,9 @@ jobs: BOT_TOKEN=$(plutil -extract 'EnvironmentVariables:TELEGRAM_BOT_TOKEN' raw /Users/freetlab/Library/LaunchAgents/ai.openclaw.gateway.plist 2>/dev/null || echo "") if [ -z "$BOT_TOKEN" ]; then exit 0; fi if [ "${{ job.status }}" = "success" ]; then - MSG="✅ *Pluriwave* v${VERSION} build OK · ${COMMIT}%0AAPK + AAB en builds.freetimelab.es" + MSG="✅ *Pluriwave* v${VERSION} build OK (firma release) · ${COMMIT}%0AAPK + AAB en builds.freetimelab.es" else MSG="❌ *Pluriwave* v${VERSION} build FAILED · ${COMMIT}" fi curl -s -X POST "https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" \ - -d "chat_id=221721467" -d "parse_mode=Markdown" -d "text=${MSG}" || true + -d "chat_id=221721467" -d "parse_mode=Markdown" -d "text=${MSG}" || true \ No newline at end of file diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 4309abf..cf54677 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -1,10 +1,21 @@ plugins { id("com.android.application") id("kotlin-android") - // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. id("dev.flutter.flutter-gradle-plugin") } +import java.util.Properties + +val keystoreProperties = Properties() +val keystorePropertiesFile = rootProject.file("key.properties") +if (keystorePropertiesFile.exists()) { + keystorePropertiesFile.inputStream().use { keystoreProperties.load(it) } +} + +fun secret(name: String, propertyName: String): String? = + keystoreProperties.getProperty(propertyName)?.takeIf { it.isNotBlank() } + ?: System.getenv(name)?.takeIf { it.isNotBlank() } + android { namespace = "es.freetimelab.pluriwave" compileSdk = flutter.compileSdkVersion @@ -20,21 +31,38 @@ android { } defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId = "es.freetimelab.pluriwave" - // You can update the following values to match your application needs. - // For more information, see: https://flutter.dev/to/review-gradle-config. minSdk = flutter.minSdkVersion targetSdk = flutter.targetSdkVersion versionCode = flutter.versionCode versionName = flutter.versionName } + signingConfigs { + create("release") { + val storeFilePath = secret("KEYSTORE_PATH", "storeFile") + val storePasswordValue = secret("KEYSTORE_PASSWORD", "storePassword") + val keyAliasValue = secret("KEYSTORE_ALIAS", "keyAlias") + val keyPasswordValue = secret("KEY_PASSWORD", "keyPassword") + + if (!storeFilePath.isNullOrBlank()) { + storeFile = file(storeFilePath) + } + if (!storePasswordValue.isNullOrBlank()) { + storePassword = storePasswordValue + } + if (!keyAliasValue.isNullOrBlank()) { + keyAlias = keyAliasValue + } + if (!keyPasswordValue.isNullOrBlank()) { + keyPassword = keyPasswordValue + } + } + } + buildTypes { release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.getByName("debug") + signingConfig = signingConfigs.getByName("release") } } } diff --git a/android/app/src/main/kotlin/es/freetimelab/pluriwave/AlarmScheduler.kt b/android/app/src/main/kotlin/es/freetimelab/pluriwave/AlarmScheduler.kt index f1e993f..4dfa6d0 100644 --- a/android/app/src/main/kotlin/es/freetimelab/pluriwave/AlarmScheduler.kt +++ b/android/app/src/main/kotlin/es/freetimelab/pluriwave/AlarmScheduler.kt @@ -508,7 +508,8 @@ class AlarmScheduler(private val context: Context) { appContext, requestCode(id, 2), Intent(appContext, MainActivity::class.java).apply { - this.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP + this.flags = + Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP putExtra(PluriWaveAlarmReceiver.EXTRA_ALARM_ACTION, PluriWaveAlarmReceiver.ACTION_FIRE) }, flags or PendingIntent.FLAG_IMMUTABLE diff --git a/pubspec.yaml b/pubspec.yaml index c939d48..75157e7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: pluriwave description: "Radio mundial con ecualizador, reconocimiento de canciones y UI premium" publish_to: 'none' -version: 0.1.48+49 +version: 0.1.53+54 environment: sdk: ^3.7.0