revert ci: workflow profesional — análisis + bump + build + deploy + notify Basado en el patrón de javihogar-android: - PATH global como env (actions/checkout funciona) - Job análisis separado - Auto-bump versión patch en cada push a main - Notify Telegram con estado - [ci skip] en commit de versión
101 lines
3.3 KiB
YAML
101 lines
3.3 KiB
YAML
name: Build & Deploy Farolero
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: [self-hosted, macos, arm64, flutter]
|
|
steps:
|
|
- name: Setup PATH
|
|
run: |
|
|
echo "/opt/homebrew/bin" >> $GITHUB_PATH
|
|
echo "/Users/freetlab/.pub-cache/bin" >> $GITHUB_PATH
|
|
export PATH="/opt/homebrew/bin:$PATH"
|
|
|
|
- name: Checkout
|
|
run: |
|
|
export PATH="/opt/homebrew/bin:$PATH"
|
|
if [ -d ".git" ]; then
|
|
git fetch origin main
|
|
git checkout main
|
|
git reset --hard origin/main
|
|
else
|
|
git clone http://192.168.0.33:3100/FreeTLab/farolero.git .
|
|
fi
|
|
|
|
- name: Flutter version
|
|
run: |
|
|
export PATH="/opt/homebrew/bin:$PATH"
|
|
flutter --version
|
|
|
|
- name: Get dependencies
|
|
run: |
|
|
export PATH="/opt/homebrew/bin:$PATH"
|
|
flutter pub get
|
|
|
|
- name: Generate l10n
|
|
run: |
|
|
export PATH="/opt/homebrew/bin:$PATH"
|
|
flutter gen-l10n
|
|
|
|
- name: Analyze
|
|
run: |
|
|
export PATH="/opt/homebrew/bin:$PATH"
|
|
flutter analyze
|
|
|
|
- name: Build APK Release
|
|
run: |
|
|
export PATH="/opt/homebrew/bin:$PATH"
|
|
flutter build apk --release
|
|
|
|
- name: Build AAB Release
|
|
run: |
|
|
export PATH="/opt/homebrew/bin:$PATH"
|
|
flutter build appbundle --release
|
|
|
|
- name: Extract version
|
|
id: version
|
|
run: |
|
|
VERSION=$(grep 'version:' pubspec.yaml | head -1 | sed 's/version: //' | sed 's/+.*//')
|
|
echo "version=v${VERSION}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Deploy to ftl-builds
|
|
run: |
|
|
VERSION=$(grep 'version:' pubspec.yaml | head -1 | sed 's/version: //' | sed 's/+.*//')
|
|
VERSION="v${VERSION}"
|
|
SSH_KEY="/Users/freetlab/.openclaw/workspace/.secure/zimaboard_ed25519"
|
|
HOST="192.168.0.33"
|
|
USER="ShanaiaBot"
|
|
BUILDS_DIR="/opt/ftl-builds/builds/farolero/${VERSION}"
|
|
|
|
ssh -i "$SSH_KEY" -o StrictHostKeyChecking=no ${USER}@${HOST} "mkdir -p ${BUILDS_DIR}"
|
|
|
|
scp -i "$SSH_KEY" \
|
|
build/app/outputs/flutter-apk/app-release.apk \
|
|
${USER}@${HOST}:${BUILDS_DIR}/farolero-${VERSION}.apk
|
|
|
|
scp -i "$SSH_KEY" \
|
|
build/app/outputs/bundle/release/app-release.aab \
|
|
${USER}@${HOST}:${BUILDS_DIR}/farolero-${VERSION}.aab
|
|
|
|
- name: Notify Telegram
|
|
if: always()
|
|
run: |
|
|
export PATH="/opt/homebrew/bin:$PATH"
|
|
VERSION=$(grep 'version:' pubspec.yaml | head -1 | sed 's/version: //' | sed 's/+.*//')
|
|
VERSION="v${VERSION}"
|
|
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
|
|
echo "No bot token found, skipping notification"
|
|
exit 0
|
|
fi
|
|
if [ "${{ job.status }}" = "success" ]; then
|
|
MSG="✅ Farolero ${VERSION} — Build OK. APK + AAB en builds.freetimelab.es"
|
|
else
|
|
MSG="❌ Farolero ${VERSION} — Build FAILED"
|
|
fi
|
|
curl -s -X POST "https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" \
|
|
-d "chat_id=221721467" -d "text=${MSG}" || true
|