|
8 | 8 |
|
9 | 9 | jobs: |
10 | 10 | build: |
11 | | - runs-on: ubuntu-latest |
12 | 11 | if: ${{ !contains(github.event.head_commit.message, 'ci skip') }} |
13 | 12 |
|
14 | 13 | strategy: |
15 | 14 | fail-fast: false |
16 | 15 | matrix: |
17 | 16 | variant: [debug, release] |
| 17 | + target: [apk, ios] |
| 18 | + include: |
| 19 | + - target: apk |
| 20 | + os: ubuntu-latest |
| 21 | + pre-build-script: "" |
| 22 | + build-args: "" |
| 23 | + debug-artifact-path: example/build/app/outputs/flutter-apk/app-debug.apk |
| 24 | + release-artifact-path: example/build/app/outputs/flutter-apk/app-release.apk |
| 25 | + - target: ios |
| 26 | + os: macos-latest |
| 27 | + pre-build-script: "" |
| 28 | + build-args: "--no-codesign" |
| 29 | + artifact-path: | |
| 30 | + example/build/ios/iphoneos/Runner.app |
| 31 | +
|
| 32 | + runs-on: ${{ matrix.os }} |
| 33 | + name: ${{ matrix.target }}-${{ matrix.variant }} |
18 | 34 |
|
19 | 35 | steps: |
20 | | - - uses: actions/checkout@v4 |
21 | | - - uses: actions/setup-java@v4 |
| 36 | + - uses: actions/checkout@v6 |
| 37 | + - uses: actions/setup-java@v5 |
| 38 | + if: ${{ matrix.target == 'apk' }} |
22 | 39 | with: |
23 | 40 | distribution: 'temurin' |
24 | 41 | java-version: '21' |
25 | 42 | - uses: subosito/flutter-action@v2 |
26 | 43 | with: |
27 | 44 | channel: 'stable' |
28 | 45 | cache: true |
29 | | - - run: dart pub get |
30 | | - - run: dart format --output=none --set-exit-if-changed . |
31 | | - - run: dart analyze |
32 | | - - run: flutter pub get |
33 | | - working-directory: example/ |
34 | | - #- run: flutter test |
35 | | - - run: flutter build apk --${{ matrix.variant }} --verbose |
36 | | - working-directory: example/ |
37 | | - - uses: actions/upload-artifact@v4 |
38 | | - with: |
39 | | - name: example-apk-${{ matrix.variant }} |
40 | | - path: | |
41 | | - example/build/app/outputs/flutter-apk/app-${{ matrix.variant }}.apk |
42 | | - example/build/reports/* |
43 | 46 |
|
44 | | - build-ios: |
45 | | - runs-on: macos-latest |
46 | | - strategy: |
47 | | - fail-fast: false |
48 | | - matrix: |
49 | | - variant: [debug, release] |
| 47 | + - name: pre-build-script for ${{ matrix.target }} |
| 48 | + run: ${{ matrix.pre-build-script }} |
| 49 | + if: ${{ matrix.pre-build-script != '' }} |
50 | 50 |
|
51 | | - steps: |
52 | | - - uses: actions/checkout@v4 |
53 | | - - uses: subosito/flutter-action@v2 |
54 | | - with: |
55 | | - channel: 'stable' |
56 | | - cache: true |
57 | 51 | - run: flutter pub get |
58 | 52 | working-directory: example/ |
59 | | - - run: flutter build ios --${{ matrix.variant }} --verbose --no-codesign |
| 53 | + |
| 54 | + - name: Run flutter ${{ matrix.variant }} build on ${{ matrix.target }} |
| 55 | + run: flutter build ${{ matrix.target }} --${{ matrix.variant }} ${{ matrix.build-args }} --verbose |
60 | 56 | working-directory: example/ |
| 57 | + |
| 58 | + - uses: actions/upload-artifact@v5 |
| 59 | + with: |
| 60 | + name: example-${{ matrix.target }}-${{ matrix.variant }} |
| 61 | + path: | |
| 62 | + ${{ matrix.debug-artifact-path }} |
| 63 | + ${{ matrix.release-artifact-path }} |
| 64 | + ${{ matrix.artifact-path }} |
0 commit comments