Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#4] [Chore] Set up the CD with Fastlane and GitHub Actions for iOS - part 2 of 2 #45

Merged
merged 2 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/ios_deploy_production_to_testflight.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: iOS - Deploy Production build to TestFlight
on:
push:
branches:
- main

jobs:
build_and_upload_production_to_testflight:
name: Build and upload iOS Production build to TestFlight
runs-on: macOS-latest
steps:
- name: Check out
uses: actions/checkout@v3

- name: Install SSH key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- name: Set up Flutter environment
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: '3.10.5'
- run: flutter --version

- name: Set up deployment environment
env:
ENV_PRODUCTION: ${{ secrets.ENV_PRODUCTION }}
run: echo "$ENV_PRODUCTION" > .env

- name: Get Flutter dependencies
run: flutter pub get

- name: Run code generator
run: flutter packages pub run build_runner build --delete-conflicting-outputs

- name: Cache Ruby gems
uses: actions/cache@v3
id: bunlderCache
with:
path: ios/vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: ${{ runner.os }}-gems-

- name: Cache Pods
uses: actions/cache@v3
id: cocoapodCache
with:
path: ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: ${{ runner.os }}-pods-

- name: Install iOS dependencies
run: cd ios && bundle install --path vendor/bundle && bundle exec pod install

- name: Sync certificates and profiles
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSPHRASE }}
run: cd ios && bundle exec fastlane sync_appstore_production_signing

- name: Build and Deploy to TestFlight
env:
BUILD_NUMBER: ${{ github.run_number }}
TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
APPSTORE_CONNECT_API_KEY_ID: ${{ secrets.APPSTORE_CONNECT_API_KEY_ID }}
APPSTORE_CONNECT_ISSUER_ID: ${{ secrets.APPSTORE_CONNECT_ISSUER_ID }}
APPSTORE_CONNECT_API_KEY_CONTENT: ${{ secrets.APPSTORE_CONNECT_API_KEY_CONTENT }}
run: cd ios && bundle exec fastlane build_and_upload_production_to_testflight
53 changes: 0 additions & 53 deletions .github/workflows/ios_deploy_to_app_store.yml

This file was deleted.

22 changes: 22 additions & 0 deletions ios/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ platform :ios do
match_manager.sync_app_store_signing(app_identifier: [Constants.BUNDLE_ID_STAGING])
end

desc 'Sync AppStore Production match signing'
lane :sync_appstore_production_signing do
match_manager.sync_app_store_signing(app_identifier: [Constants.BUNDLE_ID_PRODUCTION])
end

desc 'Sync Adhoc Staging match signing'
lane :sync_adhoc_staging_signing do
match_manager.sync_adhoc_signing(app_identifier: [Constants.BUNDLE_ID_STAGING])
Expand Down Expand Up @@ -72,6 +77,23 @@ platform :ios do
)
end

desc 'Build and upload Production app to Test Flight'
lane :build_and_upload_production_to_testflight do
set_app_version
bump_build
builder.build_app_store(
Constants.SCHEME_NAME_PRODUCTION,
Constants.PRODUCT_NAME_PRODUCTION,
Constants.BUNDLE_ID_PRODUCTION,
false
)
set_appstore_connect_api_key
distribution_manager.upload_to_testflight(
product_name: Constants.PRODUCT_NAME_PRODUCTION,
bundle_identifier: Constants.BUNDLE_ID_PRODUCTION
)
end

# AppStore

desc 'Build and upload Staging app to App Store Connect'
Expand Down
Loading