ci: workflow build + deploy + notify Telegram
Some checks failed
Build & Deploy Farolero / build (push) Has been cancelled
Some checks failed
Build & Deploy Farolero / build (push) Has been cancelled
This commit is contained in:
71
.gitea/workflows/build.yml
Normal file
71
.gitea/workflows/build.yml
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
name: Build & Deploy Farolero
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: [self-hosted, macos, arm64, flutter]
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Flutter version
|
||||||
|
run: flutter --version
|
||||||
|
|
||||||
|
- name: Get dependencies
|
||||||
|
run: flutter pub get
|
||||||
|
|
||||||
|
- name: Analyze
|
||||||
|
run: flutter analyze
|
||||||
|
|
||||||
|
- name: Generate l10n
|
||||||
|
run: flutter gen-l10n
|
||||||
|
|
||||||
|
- name: Build APK Release
|
||||||
|
run: flutter build apk --release
|
||||||
|
|
||||||
|
- name: Build AAB Release
|
||||||
|
run: 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
|
||||||
|
echo "Version: v${VERSION}"
|
||||||
|
|
||||||
|
- name: Deploy to ftl-builds
|
||||||
|
env:
|
||||||
|
SSH_KEY_PATH: /Users/freetlab/.openclaw/workspace/.secure/zimaboard_ed25519
|
||||||
|
DEPLOY_HOST: 192.168.0.33
|
||||||
|
DEPLOY_USER: ShanaiaBot
|
||||||
|
run: |
|
||||||
|
VERSION=${{ steps.version.outputs.version }}
|
||||||
|
BUILDS_DIR="/opt/ftl-builds/builds/farolero/${VERSION}"
|
||||||
|
|
||||||
|
ssh -i "$SSH_KEY_PATH" -o StrictHostKeyChecking=no ${DEPLOY_USER}@${DEPLOY_HOST} "mkdir -p ${BUILDS_DIR}"
|
||||||
|
|
||||||
|
scp -i "$SSH_KEY_PATH" \
|
||||||
|
build/app/outputs/flutter-apk/app-release.apk \
|
||||||
|
${DEPLOY_USER}@${DEPLOY_HOST}:${BUILDS_DIR}/farolero-${VERSION}.apk
|
||||||
|
|
||||||
|
scp -i "$SSH_KEY_PATH" \
|
||||||
|
build/app/outputs/bundle/release/app-release.aab \
|
||||||
|
${DEPLOY_USER}@${DEPLOY_HOST}:${BUILDS_DIR}/farolero-${VERSION}.aab
|
||||||
|
|
||||||
|
- name: Notify Telegram
|
||||||
|
if: always()
|
||||||
|
env:
|
||||||
|
BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
||||||
|
CHAT_ID: 221721467
|
||||||
|
run: |
|
||||||
|
VERSION=${{ steps.version.outputs.version }}
|
||||||
|
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=${CHAT_ID}&text=${MSG}&parse_mode=HTML" > /dev/null 2>&1 || true
|
||||||
Reference in New Issue
Block a user