- Revert subosito/flutter-action to direct Flutter SDK download (action was failing on Magrathea runner, works inconsistently across runners) - Fix release.yml: replace 3x hardcoded 'token ***' with $GITEA_TOKEN env var for Gitea release API calls - Fix release.yml: replace GitHub-specific actions (setup-java, setup-python, upload-artifact) with manual SDK downloads - Update Dockerfile: Flutter 3.41.8 -> 3.44.0, tarball instead of git clone, removed unnecessary packages (cmake, clang, pip, pipx, lld, mesa-utils), JRE headless instead of full JDK - Simplify release.yml publish-release: single step to create Gitea release (artifact upload pending storage configuration)
281 lines
9.7 KiB
YAML
281 lines
9.7 KiB
YAML
# kryz-go-flutter Release Pipeline
|
|
# Triggers on version tags (v1.0.0, v1.0.1, etc.)
|
|
# Produces signed artifacts and attaches them to a Gitea Release
|
|
|
|
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
env:
|
|
FLUTTER_VERSION: "stable"
|
|
|
|
jobs:
|
|
# ── Lint (gate) ─────────────────────────────────────────────
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Flutter
|
|
run: |
|
|
set -e
|
|
curl -fsSL "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.44.0-stable.tar.xz" \
|
|
-o /tmp/flutter.tar.xz
|
|
tar -xf /tmp/flutter.tar.xz -C "$PWD"
|
|
export PATH="$PWD/flutter/bin:$PATH"
|
|
flutter --version
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
export PATH="$PWD/flutter/bin:$PATH"
|
|
flutter pub get
|
|
|
|
- name: Generate stubs (lint gate support)
|
|
if: hashFiles('theme.json') == ''
|
|
run: |
|
|
export PATH="$PWD/flutter/bin:$PATH"
|
|
python3 ci_stub_gen.py
|
|
|
|
- name: Analyze Dart code
|
|
run: |
|
|
export PATH="$PWD/flutter/bin:$PATH"
|
|
flutter analyze --fatal-warnings
|
|
|
|
- name: Check formatting
|
|
run: |
|
|
export PATH="$PWD/flutter/bin:$PATH"
|
|
dart format --set-exit-if-changed lib/ test/
|
|
|
|
|
|
# ── Test (gate) ──────────────────────────────────────────────────
|
|
test:
|
|
name: Test
|
|
runs-on: ubuntu-latest
|
|
needs: [lint]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Flutter
|
|
run: |
|
|
set -e
|
|
curl -fsSL "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.44.0-stable.tar.xz" \
|
|
-o /tmp/flutter.tar.xz
|
|
tar -xf /tmp/flutter.tar.xz -C "$PWD"
|
|
export PATH="$PWD/flutter/bin:$PATH"
|
|
flutter --version
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
export PATH="$PWD/flutter/bin:$PATH"
|
|
flutter pub get
|
|
|
|
- name: Generate stubs (lint gate support)
|
|
run: |
|
|
export PATH="$PWD/flutter/bin:$PATH"
|
|
python3 ci_stub_gen.py
|
|
|
|
- name: Run tests
|
|
run: |
|
|
export PATH="$PWD/flutter/bin:$PATH"
|
|
flutter test --reporter=expanded
|
|
|
|
|
|
# ── Android release build ───────────────────────────────────
|
|
build-android:
|
|
name: Build Android Release
|
|
runs-on: ubuntu-latest
|
|
needs: [test]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Java 17
|
|
run: |
|
|
set -e
|
|
curl -fsSL "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.12%2B7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.12_7.tar.gz" \
|
|
-o /tmp/jdk.tar.gz
|
|
mkdir -p "$HOME/jdk"
|
|
tar -xzf /tmp/jdk.tar.gz -C "$HOME/jdk" --strip-components=1
|
|
export PATH="$HOME/jdk/bin:$PATH"
|
|
export JAVA_HOME="$HOME/jdk"
|
|
java -version
|
|
|
|
- name: Setup Flutter
|
|
run: |
|
|
set -e
|
|
curl -fsSL "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.44.0-stable.tar.xz" \
|
|
-o /tmp/flutter.tar.xz
|
|
tar -xf /tmp/flutter.tar.xz -C "$PWD"
|
|
export PATH="$PWD/flutter/bin:$PATH"
|
|
flutter --version
|
|
|
|
- name: Pre-cache Android platform artifacts
|
|
run: |
|
|
export PATH="$PWD/flutter/bin:$PATH"
|
|
flutter precache --android
|
|
|
|
- name: Accept Android SDK licenses
|
|
run: |
|
|
yes | "${HOME}/android-sdk/cmdline-tools/latest/bin/sdkmanager" --licenses || true
|
|
|
|
- name: Setup Python
|
|
run: |
|
|
set -e
|
|
python3 --version
|
|
|
|
- name: Install Python dependencies
|
|
run: |
|
|
python3 -m pip install --upgrade pip || true
|
|
pip install -r requirements.txt || true
|
|
|
|
- name: Install Flutter dependencies
|
|
run: |
|
|
export PATH="$PWD/flutter/bin:$PATH"
|
|
flutter pub get
|
|
|
|
- name: Generate stubs (lint gate support)
|
|
run: |
|
|
export PATH="$PWD/flutter/bin:$PATH"
|
|
python3 ci_stub_gen.py
|
|
|
|
# If release signing secrets are available, write keystore
|
|
# and update build.gradle.kts to use a release signing config.
|
|
# Otherwise fall back to debug keys (current state of the repo).
|
|
- name: Configure release signing
|
|
if: env.ANDROID_KEYSTORE_BASE64 != ''
|
|
env:
|
|
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
|
|
ANDROID_KEYSTORE_PASS: ${{ secrets.ANDROID_KEYSTORE_PASS }}
|
|
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
|
|
ANDROID_KEY_PASS: ${{ secrets.ANDROID_KEY_PASS }}
|
|
run: |
|
|
echo "$ANDROID_KEYSTORE_BASE64" | base64 -d > android/app/release.keystore
|
|
cat > android/key.properties <<EOF
|
|
storePassword=$ANDROID_KEYSTORE_PASS
|
|
keyPassword=$ANDROID_KEY_PASS
|
|
keyAlias=$ANDROID_KEY_ALIAS
|
|
storeFile=../release.keystore
|
|
EOF
|
|
|
|
- name: Build APK (release)
|
|
run: |
|
|
export JAVA_HOME="$HOME/jdk"
|
|
export PATH="$PWD/flutter/bin:$PATH"
|
|
flutter build apk --release
|
|
|
|
- name: Build App Bundle (release)
|
|
run: |
|
|
export JAVA_HOME="$HOME/jdk"
|
|
export PATH="$PWD/flutter/bin:$PATH"
|
|
flutter build appbundle --release
|
|
|
|
- name: List build outputs
|
|
run: |
|
|
echo "=== APK output ==="
|
|
ls -lh build/app/outputs/flutter-apk/ || true
|
|
echo "=== AAB output ==="
|
|
ls -lh build/app/outputs/bundle/release/ || true
|
|
|
|
- name: "Note: artifact storage not configured"
|
|
run: |
|
|
echo "WARNING: Gitea Actions artifact storage is not configured on this instance."
|
|
echo "Build outputs available in runner workspace:"
|
|
echo " APK: build/app/outputs/flutter-apk/app-release.apk"
|
|
echo " AAB: build/app/outputs/bundle/release/app-release.aab"
|
|
|
|
|
|
# ── iOS release build ───────────────────────────────────────
|
|
# Note: requires a macOS runner. Uses 'self-hosted' label which
|
|
# matches our Gitea Actions runner. Falls back to --no-codesign
|
|
# if Apple signing secrets are not configured.
|
|
build-ios:
|
|
name: Build iOS Release
|
|
runs-on: [self-hosted, macos]
|
|
needs: [test]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Flutter
|
|
run: |
|
|
set -e
|
|
curl -fsSL "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.44.0-stable.tar.xz" \
|
|
-o /tmp/flutter.tar.xz
|
|
tar -xf /tmp/flutter.tar.xz -C "$PWD"
|
|
export PATH="$PWD/flutter/bin:$PATH"
|
|
flutter --version
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
export PATH="$PWD/flutter/bin:$PATH"
|
|
flutter pub get
|
|
|
|
- name: Install CocoaPods dependencies
|
|
run: cd ios && pod install --repo-update
|
|
|
|
# Configure Apple signing if secrets are available
|
|
- name: Install Apple certificate
|
|
if: env.APPLE_CERTIFICATE_P12 != ''
|
|
env:
|
|
APPLE_CERTIFICATE_P12: ${{ secrets.APPLE_CERTIFICATE_P12 }}
|
|
APPLE_CERTIFICATE_PASS: ${{ secrets.APPLE_CERTIFICATE_PASS }}
|
|
APPLE_PROVISION_PROFILE: ${{ secrets.APPLE_PROVISION_PROFILE }}
|
|
run: |
|
|
KEYCHAIN_PATH=$RUNNER_TEMP/build.keychain
|
|
CERTIFICATE_PATH=$RUNNER_TEMP/certificate.p12
|
|
PROVISION_PATH=$RUNNER_TEMP/profile.mobileprovision
|
|
|
|
echo "$APPLE_CERTIFICATE_P12" | base64 -d > "$CERTIFICATE_PATH"
|
|
echo "$APPLE_PROVISION_PROFILE" | base64 -d > "$PROVISION_PATH"
|
|
|
|
security create-keychain -p "" "$KEYCHAIN_PATH"
|
|
security default-keychain -s "$KEYCHAIN_PATH"
|
|
security unlock-keychain -p "" "$KEYCHAIN_PATH"
|
|
security set-keychain-settings -t 3600 -l "$KEYCHAIN_PATH"
|
|
security import "$CERTIFICATE_PATH" -P "$APPLE_CERTIFICATE_PASS" \
|
|
-A -t cert -f pkcs12 -k "$KEYCHAIN_PATH"
|
|
security set-key-partition-list -S apple-tool:,apple: -k "" "$KEYCHAIN_PATH"
|
|
|
|
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
|
|
cp "$PROVISION_PATH" ~/Library/MobileDevice/Provisioning\ Profiles/
|
|
|
|
- name: Build iOS (release)
|
|
if: env.APPLE_CERTIFICATE_P12 != ''
|
|
run: |
|
|
export PATH="$PWD/flutter/bin:$PATH"
|
|
flutter build ios --release
|
|
|
|
- name: Build iOS (release, no-codesign)
|
|
if: env.APPLE_CERTIFICATE_P12 == ''
|
|
run: |
|
|
export PATH="$PWD/flutter/bin:$PATH"
|
|
flutter build ios --release --no-codesign
|
|
|
|
|
|
# ── Publish Gitea Release ────────────────────────────────────
|
|
publish-release:
|
|
name: Publish Release
|
|
runs-on: ubuntu-latest
|
|
needs: [build-android]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Create Gitea Release
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
TAG: ${{ gitea.ref_name }}
|
|
GITEA_BASE: https://git.westerntechnologies.duckdns.org
|
|
run: |
|
|
curl -s -X POST \
|
|
-H "Authorization: token $GITEA_TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"tag_name\": \"$TAG\", \"name\": \"$TAG\", \"body\": \"Automated release build for $TAG\"}" \
|
|
"$GITEA_BASE/api/v1/repos/kfj001/kryz-go-flutter/releases"
|