-
Notifications
You must be signed in to change notification settings - Fork 1
116 lines (98 loc) · 2.87 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: Build
# Triggered manually or when code is pushed
# (branch name exclusion list below)
on:
push:
branches:
- "**"
- "!main" # Prevent build when pushing main
- "!wip/*" # Prevent build when pushing on wip/*
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
analyse:
name: Analyse Flutter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- uses: subosito/flutter-action@v2
with:
channel: "stable"
- name: Install dependencies
run: flutter pub get
# Uncomment this step to verify the use of 'dart format' on each commit.
# - name: Verify formatting
# run: dart format --output=none --set-exit-if-changed .
# run: dart format --output=none --set-exit-if-changed example
# Consider passing '--fatal-infos' for slightly stricter analysis.
- name: Analyze project source
run: flutter analyze --no-fatal-infos
build_android:
name: Build for Android
needs: analyse
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- uses: subosito/flutter-action@v2
with:
channel: "stable"
- name: Install dependencies
run: flutter pub get
# Android APK
- name: Build Android Sample
working-directory: ./example
run: flutter build apk -t lib/main.dart
# Archive Android APK
- name: Archive Android artifacts
uses: actions/upload-artifact@v4
with:
name: android-app
path: example/build/app/outputs/flutter-apk/*.apk
retention-days: 5
build_ios:
name: Build for iOS
needs: analyse
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- uses: subosito/flutter-action@v2
with:
channel: "stable"
- name: Install dependencies
run: flutter pub get
# pod update
- name: Run pod update
working-directory: ./example/ios
run: pod update
# iOS IPA
- name: Build iOS Sample
working-directory: ./example
run: |
flutter build ios --no-codesign
cd build/ios/iphoneos
mkdir Payload
cd Payload
ln -s ../Runner.app
cd ..
zip -r app.ipa Payload
# Archive iOS IPA
- name: Archive iOS artifacts
uses: actions/upload-artifact@v4
with:
name: ios-app
path: example/build/ios/iphoneos/*.ipa
retention-days: 5