Skip to content

Commit

Permalink
Add Workflow Build TestFlight
Browse files Browse the repository at this point in the history
  • Loading branch information
rickirby committed Nov 18, 2023
1 parent c7f2061 commit 3792663
Show file tree
Hide file tree
Showing 10 changed files with 124 additions and 28 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/build_testflight.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# This workflow will build a Swift project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift

name: Build TestFlight

on:
workflow_dispatch:

jobs:
prepare_provisioning_profiles:
name: Build TestFlight
runs-on: macos-latest

steps:
- name: Xcode Select Version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '14.1'

- name: Checkout Branch
uses: actions/checkout@v2

- name: Install Bundle Dependency
run: |
bundle install
- name: Install XcodeGen
run: |
brew install xcodegen
- name: Setup CI Keychain
env:
MATCH_KEYCHAIN: ${{ vars.MATCH_KEYCHAIN }}
MATCH_PASSWORD: ${{ vars.MATCH_PASSWORD }}
run: |
bundle exec fastlane setupCIKeychain
- name: Change Build Number
run: |
./Tooling/change_build_number.sh ${{ github.run_number }}
- name: Setup Project
run: |
./setup.sh
- name: Build IPA and Upload to TestFlight using Fastlane
env:
APP_STORE_CONNECT_API_KEY_IN_HOUSE: ${{ vars.APP_STORE_CONNECT_API_KEY_IN_HOUSE }}
APP_STORE_CONNECT_API_KEY_ISSUER_ID: ${{ vars.APP_STORE_CONNECT_API_KEY_ISSUER_ID }}
APP_STORE_CONNECT_API_KEY_IS_KEY_CONTENT_BASE64: ${{ vars.APP_STORE_CONNECT_API_KEY_IS_KEY_CONTENT_BASE64 }}
APP_STORE_CONNECT_API_KEY_KEY: ${{ vars.APP_STORE_CONNECT_API_KEY_KEY }}
APP_STORE_CONNECT_API_KEY_KEY_ID: ${{ vars.APP_STORE_CONNECT_API_KEY_KEY_ID }}
MATCH_GIT_BASIC_AUTHORIZATION: ${{ vars.MATCH_GIT_BASIC_AUTHORIZATION }}
MATCH_KEYCHAIN: ${{ vars.MATCH_KEYCHAIN }}
MATCH_PASSWORD: ${{ vars.MATCH_PASSWORD }}
run: |
bundle exec fastlane build_testflight
25 changes: 0 additions & 25 deletions .github/workflows/prepare_profiles.yml

This file was deleted.

1 change: 1 addition & 0 deletions Configuration/AdHoc.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
APP_NAME = Scandocs (AdHoc)
BUNDLE_ID = com.scandocs.ios
APP_PROVISIONING_PROFILE = match AdHoc com.scandocs.ios
CODE_SIGN_IDENTITY = Apple Distribution: Ricki Bin Yamin (6NMANHT3A2)
VALIDATE_PRODUCT = NO
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
TARGETED_DEVICE_FAMILY = 1
Expand Down
1 change: 1 addition & 0 deletions Configuration/Development.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
APP_NAME = Scandocs (Development)
BUNDLE_ID = com.scandocs.ios
APP_PROVISIONING_PROFILE = match Development com.scandocs.ios
CODE_SIGN_IDENTITY = Apple Development: Ricki Bin Yamin (BWBZZ27H86)
VALIDATE_PRODUCT = NO
DEBUG_INFORMATION_FORMAT = dwarf
TARGETED_DEVICE_FAMILY = 1
Expand Down
1 change: 1 addition & 0 deletions Configuration/Release.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
APP_NAME = Scandocs
BUNDLE_ID = com.scandocs.ios
APP_PROVISIONING_PROFILE = match AppStore com.scandocs.ios
CODE_SIGN_IDENTITY = Apple Distribution: Ricki Bin Yamin (6NMANHT3A2)
VALIDATE_PRODUCT = YES
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
TARGETED_DEVICE_FAMILY = 1
Expand Down
6 changes: 6 additions & 0 deletions Fastlane/Appfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
app_identifier("com.scandocs.ios") # The bundle identifier of your app
apple_id("[email protected]") # Your Apple Developer Portal username


# For more information about the Appfile, see:
# https://docs.fastlane.tools/advanced/#appfile
41 changes: 38 additions & 3 deletions Fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,63 @@
default_platform(:ios)

platform :ios do

desc "Setup CI Keychain to prevent stack due to default keychain locked"
lane :setupCIKeychain do
create_keychain(
name: ENV["MATCH_KEYCHAIN"],
password: ENV["MATCH_PASSWORD"],
default_keychain: true,
unlock: true,
timeout: 3600,
add_to_search_list: true,
verbose: true
)
end

desc "Preparing Certificate and Provisioning Profiles on New Device Setup"
lane :prepare do
match(
git_basic_authorization: ENV["MATCH_GIT_BASIC_AUTHORIZATION"],
app_identifier: "com.scandocs.ios",
type: "development",
readonly: true
)

match(
git_basic_authorization: ENV["MATCH_GIT_BASIC_AUTHORIZATION"],
app_identifier: "com.scandocs.ios",
type: "adhoc",
readonly: true
)

match(
git_basic_authorization: ENV["MATCH_GIT_BASIC_AUTHORIZATION"],
app_identifier: "com.scandocs.ios",
type: "appstore",
readonly: true
)
end

desc "Build TestFlight"
lane :build_testflight do
match(
keychain_name: ENV["MATCH_KEYCHAIN"] || "login.keychain" ,
keychain_password: ENV["MATCH_PASSWORD"] || "",
app_identifier: "com.scandocs.ios",
type: "appstore",
readonly: true
)

build_app(
workspace: "Scandocs.xcworkspace",
scheme: "Scandocs",
configuration: "Release",
export_method: "app-store"
)

app_store_connect_api_key

upload_to_testflight(
skip_waiting_for_build_processing: true,
skip_submission: true
)
end
end
8 changes: 8 additions & 0 deletions Scandocs/Supporting Files/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
<string>$(VERSION_NAME)</string>
<key>CFBundleVersion</key>
<string>$(BUILD_NUMBER)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleDisplayName</key>
<string>$(APP_NAME)</string>
<key>CFBundleName</key>
<string>$(APP_NAME)</string>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
Expand Down Expand Up @@ -41,5 +47,7 @@
<string>The app needs access to save scanned documents in your photo library</string>
<key>NSCameraUsageDescription</key>
<string>The app needs access your camera to capture the document that will be scanned</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
</dict>
</plist>
11 changes: 11 additions & 0 deletions Tooling/change_build_number.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Input Param
new_build_number="$1"

# Change BUILD_NUMBER in .xcconfig files
echo -e "\033[0;33mChange BUILD_NUMBER in all .xcconfig files into $new_build_number...\033[0m"
xcconfig_path="Configuration"

find "$xcconfig_path" -type f -name "*.xcconfig" -exec sed -i '' -e "s/BUILD_NUMBER = .*/BUILD_NUMBER = $new_build_number/" {} \;
echo -e "\033[0;32m✅ Successfully update BUILD_NUMBER to $new_build_number in all .xcconfig files\033[0m"
1 change: 1 addition & 0 deletions project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ settings:
BUILD_NUMBER: $(BUILD_NUMBER)
VERSION_NAME: $(VERSION_NAME)
PROVISIONING_PROFILE_SPECIFIER: $(APP_PROVISIONING_PROFILE)
CODE_SIGN_IDENTITY: $(CODE_SIGN_IDENTITY)

targets:
Scandocs:
Expand Down

0 comments on commit 3792663

Please sign in to comment.