97 lines
3.2 KiB
YAML
97 lines
3.2 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=$(grep -A1 "TELEGRAM_BOT_TOKEN" /Users/freetlab/Library/LaunchAgents/ai.openclaw.gateway.plist | grep string | sed 's/.*<string>\(.*\)<\/string>/\1/' | tr -d '[:space:]')
|
|
if [ "${{ job.status }}" = "success" ]; then
|
|
MSG="✅ Farolero ${VERSION} — Build OK%0AAPK + 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&text=${MSG}" > /dev/null 2>&1 || true
|