Refactor CI workflow to separate setup, testing, and building steps; add Linux AppImage packaging support

This commit is contained in:
Dr.Blank 2025-04-04 21:46:51 +05:30
parent be4b4beb00
commit 62c8a52e2a
No known key found for this signature in database
GPG key ID: BA5F87FF0560C57B

View file

@ -10,16 +10,28 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
test: setup:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
# This ensures submodules are cloned
submodules: recursive submodules: recursive
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version-file: pubspec.yaml
- name: Install dependencies
run: flutter pub get
test:
needs: setup
runs-on: ubuntu-latest
steps:
# Debug: Echo current directory contents # Debug: Echo current directory contents
- name: List root directory contents - name: List root directory contents
run: | run: |
@ -47,28 +59,44 @@ jobs:
- name: Decode android/key.properties - name: Decode android/key.properties
run: echo "${{ secrets.KEY_PROPERTIES }}" | base64 --decode > android/key.properties run: echo "${{ secrets.KEY_PROPERTIES }}" | base64 --decode > android/key.properties
- name: Set up Flutter - name: Run flutter tests
uses: subosito/flutter-action@v2
with:
channel: "stable"
- name: Install dependencies
run: flutter pub get
- name: Run tests
run: flutter test run: flutter test
build_android:
needs: test
runs-on: ubuntu-latest
steps:
- name: Set Up Java - name: Set Up Java
uses: actions/setup-java@v3.12.0 uses: actions/setup-java@v3.12.0
with: with:
distribution: "oracle" distribution: "oracle"
java-version: "17" java-version: "17"
- name: Build APK - name: Build Universal APK
run: flutter build apk --release run: flutter build apk --release
- name: Upload APKs - name: Rename Universal APK
run: mv build/app/outputs/flutter-apk/{app-release,app-universal-release}.apk
build_linux:
needs: test
runs-on: ubuntu-latest
steps:
- name: setup fastforge
run: |
dart pub global activate fastforge
- name: Build Linux AppImage
run: fastforge package --platform linux --targets deb
upload_artifacts:
needs: [build_android, build_linux]
runs-on: ubuntu-latest
steps:
- name: Upload Artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: app-release name: build-artifacts
path: build/app/outputs/flutter-apk/*.apk path: |
build/app/outputs/flutter-apk/*.apk
dist/*/*.deb