Skip to content

Commit 5be7e86

Browse files
committed
cicd: split job into builds
1 parent 254c934 commit 5be7e86

1 file changed

Lines changed: 54 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ jobs:
106106
verbose: true
107107
file: coverage/lcov.info
108108

109-
build: # Dynamically build for dev or prod depending on the branch
109+
build_android:
110110
if: ${{ github.ref == 'refs/heads/development' || github.ref == 'refs/heads/master' }}
111111
needs: [analyze, test]
112112
runs-on: macos-latest
@@ -186,6 +186,53 @@ jobs:
186186
# Prerequisites for building iOS
187187
# https://docs.github.com/en/actions/deployment/deploying-xcode-applications/installing-an-apple-certificate-on-macos-runners-for-xcode-development
188188

189+
build_ios:
190+
if: ${{ github.ref == 'refs/heads/development' || github.ref == 'refs/heads/master' }}
191+
needs: [analyze, test]
192+
runs-on: macos-latest
193+
timeout-minutes: 60
194+
steps:
195+
- name: Fetch code from cache
196+
id: code-cache
197+
uses: actions/cache@v3
198+
with:
199+
path: .
200+
key: code-cache-${{ github.sha }}
201+
restore-keys: |
202+
code-cache-${{ github.sha }}
203+
code-cache-
204+
code-cache
205+
206+
- name: Create release notes file
207+
run: |
208+
cat > release_notes.txt <<EOF
209+
Run: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
210+
Commit: $(git rev-parse --short HEAD)
211+
Author: $(git log -1 --pretty=format:'%an')
212+
Message: $(git log -1 --pretty=%B)
213+
EOF
214+
215+
- name: Cache Flutter install
216+
uses: actions/cache@v3
217+
with:
218+
# Linux (deprecate):
219+
# path: /opt/hostedtoolcache/flutter
220+
# MacOS:
221+
path: /Users/runner/hostedtoolcache/flutter
222+
key: cache-flutter-${{ env.flutter_channel }}-${{ env.flutter_version }}-${{ runner.os }}
223+
224+
- name: Setup the Flutter environment
225+
uses: subosito/flutter-action@v2
226+
with:
227+
channel: ${{ env.flutter_channel }}
228+
flutter-version: ${{ env.flutter_version }}
229+
230+
- name: Get Flutter dependencies
231+
run: flutter pub get .
232+
233+
- name: Generate app icons
234+
run: flutter pub run flutter_launcher_icons:main
235+
189236
- name: Install the Apple certificate and provisioning profile
190237
env:
191238
BUILD_CERTIFICATE_BASE64: ${{ secrets.IOS_CERT_P12 }}
@@ -266,6 +313,9 @@ jobs:
266313
channel: ${{ env.flutter_channel }}
267314
flutter-version: ${{ env.flutter_version }}
268315

316+
- name: Install Widgetbook CLI
317+
run: dart pub global activate widgetbook_cli
318+
269319
- name: Get Flutter dependencies
270320
run: flutter pub get .
271321

@@ -275,10 +325,10 @@ jobs:
275325
flutter build web -t widgetbook/main.dart
276326
277327
- name: Publish to Widgetbook
278-
run: widgetbook publish --api-key $WIDGETBOOK_API_KEY
328+
run: widgetbook publish --api-key $WIDGETBOOK_API_KEY --repository collaction_app --actor ${{ github.actor }}
279329

280330
distribute_android:
281-
needs: [build]
331+
needs: [build_android]
282332
runs-on: ubuntu-latest
283333
steps:
284334
- name: Download generated apk from the artifacts
@@ -296,7 +346,7 @@ jobs:
296346
releaseNotesFile: release_notes.txt
297347

298348
distribute_ios:
299-
needs: [build]
349+
needs: [build_ios]
300350
runs-on: macos-latest
301351
steps:
302352
- name: Download generated ipa from the artifacts

0 commit comments

Comments
 (0)