Skip to content

Commit

Permalink
cicd: split job into builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Xazin committed Dec 11, 2022
1 parent 254c934 commit 5be7e86
Showing 1 changed file with 54 additions and 4 deletions.
58 changes: 54 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
verbose: true
file: coverage/lcov.info

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

build_ios:
if: ${{ github.ref == 'refs/heads/development' || github.ref == 'refs/heads/master' }}
needs: [analyze, test]
runs-on: macos-latest
timeout-minutes: 60
steps:
- name: Fetch code from cache
id: code-cache
uses: actions/cache@v3
with:
path: .
key: code-cache-${{ github.sha }}
restore-keys: |
code-cache-${{ github.sha }}
code-cache-
code-cache
- name: Create release notes file
run: |
cat > release_notes.txt <<EOF
Run: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
Commit: $(git rev-parse --short HEAD)
Author: $(git log -1 --pretty=format:'%an')
Message: $(git log -1 --pretty=%B)
EOF
- name: Cache Flutter install
uses: actions/cache@v3
with:
# Linux (deprecate):
# path: /opt/hostedtoolcache/flutter
# MacOS:
path: /Users/runner/hostedtoolcache/flutter
key: cache-flutter-${{ env.flutter_channel }}-${{ env.flutter_version }}-${{ runner.os }}

- name: Setup the Flutter environment
uses: subosito/flutter-action@v2
with:
channel: ${{ env.flutter_channel }}
flutter-version: ${{ env.flutter_version }}

- name: Get Flutter dependencies
run: flutter pub get .

- name: Generate app icons
run: flutter pub run flutter_launcher_icons:main

- name: Install the Apple certificate and provisioning profile
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.IOS_CERT_P12 }}
Expand Down Expand Up @@ -266,6 +313,9 @@ jobs:
channel: ${{ env.flutter_channel }}
flutter-version: ${{ env.flutter_version }}

- name: Install Widgetbook CLI
run: dart pub global activate widgetbook_cli

- name: Get Flutter dependencies
run: flutter pub get .

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

distribute_android:
needs: [build]
needs: [build_android]
runs-on: ubuntu-latest
steps:
- name: Download generated apk from the artifacts
Expand All @@ -296,7 +346,7 @@ jobs:
releaseNotesFile: release_notes.txt

distribute_ios:
needs: [build]
needs: [build_ios]
runs-on: macos-latest
steps:
- name: Download generated ipa from the artifacts
Expand Down

0 comments on commit 5be7e86

Please sign in to comment.