120 lines
4.3 KiB
YAML
120 lines
4.3 KiB
YAML
name: Build & Deploy Farolero
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
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/farolero/farolero-upload.jks
|
|
KEYSTORE_ALIAS: upload
|
|
|
|
jobs:
|
|
analizar:
|
|
name: Análisis de código
|
|
runs-on: [self-hosted, macos, arm64, flutter]
|
|
steps:
|
|
- name: Clonar repositorio
|
|
run: |
|
|
git clone https://ShanaiaBot:${{ secrets.GITEA_TOKEN }}@git.freetimelab.es/FreeTLab/farolero.git .
|
|
git fetch origin main
|
|
git checkout main
|
|
|
|
- name: Verificar Flutter
|
|
run: |
|
|
which flutter
|
|
flutter --version
|
|
- name: Obtener dependencias
|
|
run: flutter pub get
|
|
- name: Generar l10n
|
|
run: flutter gen-l10n
|
|
- name: Analizar código
|
|
run: flutter analyze --no-fatal-infos
|
|
|
|
build:
|
|
name: Build APK + AAB release
|
|
runs-on: [self-hosted, macos, arm64, flutter]
|
|
needs: analizar
|
|
if: ${{ gitea.ref == 'refs/heads/main' }}
|
|
steps:
|
|
- name: Clonar repositorio
|
|
run: |
|
|
git clone https://ShanaiaBot:${{ secrets.GITEA_TOKEN }}@git.freetimelab.es/FreeTLab/farolero.git .
|
|
git fetch origin main
|
|
git checkout main
|
|
|
|
- name: Verificar Flutter
|
|
run: |
|
|
which flutter
|
|
flutter --version
|
|
|
|
- name: Configurar keystore de firma
|
|
env:
|
|
KEYSTORE_PASSWORD: *** secrets.FAROLERO_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: |
|
|
git config user.name "ShanaiaBot"
|
|
git config user.email "shanaia@freetimelab.es"
|
|
CURRENT=$(grep '^version:' pubspec.yaml | awk '{print $2}')
|
|
SEMVER=$(echo $CURRENT | cut -d'+' -f1)
|
|
BUILD=$(echo $CURRENT | cut -d'+' -f2)
|
|
MAJOR=$(echo $SEMVER | cut -d. -f1)
|
|
MINOR=$(echo $SEMVER | cut -d. -f2)
|
|
PATCH=$(echo $SEMVER | cut -d. -f3)
|
|
NEW_PATCH=$((PATCH + 1))
|
|
NEW_BUILD=$((BUILD + 1))
|
|
NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}+${NEW_BUILD}"
|
|
sed -i '' "s/^version: .*/version: ${NEW_VERSION}/" pubspec.yaml
|
|
git add pubspec.yaml
|
|
git commit -m "chore: bump version to ${NEW_VERSION} [ci skip]"
|
|
git push origin main
|
|
|
|
- name: Extraer versión
|
|
id: version
|
|
run: |
|
|
VERSION=$(grep '^version:' pubspec.yaml | awk '{print $2}' | cut -d'+' -f1)
|
|
COMMIT=$(git rev-parse --short HEAD)
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
echo "commit=$COMMIT" >> $GITHUB_OUTPUT
|
|
|
|
- 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: Publicar en ftl-builds (Zimaboard)
|
|
run: |
|
|
VERSION="${{ steps.version.outputs.version }}"
|
|
APK_NOMBRE="farolero-v${VERSION}.apk"
|
|
AAB_NOMBRE="farolero-v${VERSION}.aab"
|
|
DESTINO="/opt/ftl-builds/builds/farolero/v${VERSION}"
|
|
SSH_KEY="***"
|
|
|
|
ssh -i "$SSH_KEY" -o StrictHostKeyChecking=no ShanaiaBot@192.168.0.33 "mkdir -p ${DESTINO}"
|
|
scp -i "$SSH_KEY" -o StrictHostKeyChecking=no \
|
|
build/app/outputs/flutter-apk/app-release.apk \
|
|
"ShanaiaBot@192.168.0.33:${DESTINO}/${APK_NOMBRE}"
|
|
scp -i "$SSH_KEY" -o StrictHostKeyChecking=no \
|
|
build/app/outputs/bundle/release/app-release.aab \
|
|
"ShanaiaBot@192.168.0.33:${DESTINO}/${AAB_NOMBRE}"
|
|
echo "✅ APK: builds.freetimelab.es → farolero → v${VERSION}"
|
|
echo "✅ AAB: builds.freetimelab.es → farolero → v${VERSION}" |