Skip to content

Commit

Permalink
[#4] Set up CD pipeline for deploying iOS production build to TestFlight
Browse files Browse the repository at this point in the history
  • Loading branch information
Thieurom committed Aug 2, 2023
1 parent d8df4fc commit 082bcb8
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 53 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/ios_deploy_production_to_testflight.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: iOS - Deploy Production build to TestFlight
on:
workflow_dispatch:
pull_request:
types: [ opened, synchronize, edited, reopened ]
# 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

0 comments on commit 082bcb8

Please sign in to comment.