Skip to content

Commit

Permalink
Setup workflow and fastlane/match for PublisherExampleSwiftUI app, so…
Browse files Browse the repository at this point in the history
…me minor improvements to the SubscriberExample's Fastfile
  • Loading branch information
JakubJankowski committed Dec 8, 2022
1 parent 213914b commit fce1272
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 27 deletions.
38 changes: 31 additions & 7 deletions .github/workflows/testflight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ on:
branches:
- main

env:
FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APPS_APPLICATION_SPECIFIC_PASSWORD }}
MATCH_GIT_URL: ${{ secrets.APPLE_APPS_MATCH_GIT_URL }}
MATCH_PASSWORD: ${{ secrets.APPLE_APPS_MATCH_ENCRYPTION_PASSPHRASE }}
FASTLANE_XCODE_LIST_TIMEOUT: 100
FASTLANE_XCODEBUILD_SETTINGS_RETRIES: 6
MATCH_DEPLOY_KEY: ${{ secrets.APPLE_APPS_MATCH_DEPLOY_KEY }}

jobs:
build:
runs-on: macos-latest
Expand Down Expand Up @@ -40,6 +48,27 @@ jobs:
ABLY_API_KEY: ${{ secrets.ASSET_TRACKING_TESTING_ABLY_API_KEY }}
AMPLIFY_CONFIGURATION: ${{ secrets.AMPLIFY_CONFIGURATION }}

# Needed for communication with the Match secrets repo
# - name: Add deploy key to keychain
# run: |
# echo "$MATCH_DEPLOY_KEY" > deployKey
# eval "$(ssh-agent -s)"
# chmod 400 deployKey
# ssh-add deployKey
# ssh-keyscan github.com >> ~/.ssh/known_hosts
# env:
# MATCH_DEPLOY_KEY: ${{ secrets.APPLE_APPS_MATCH_DEPLOY_KEY }}

- name: Run Fastlane for the Publisher example app
working-directory: Examples/PublisherExampleSwiftUI
run: |
echo "$MATCH_DEPLOY_KEY" > deployKey
eval "$(ssh-agent -s)"
chmod 400 deployKey
ssh-add deployKey
ssh-keyscan github.com >> ~/.ssh/known_hosts
bundle exec fastlane build_and_upload_to_testflight
- name: Run Fastlane for the Subscriber example app
working-directory: Examples/SubscriberExample
run: |
Expand All @@ -49,11 +78,6 @@ jobs:
ssh-add deployKey
ssh-keyscan github.com >> ~/.ssh/known_hosts
bundle exec fastlane build_and_upload_to_testflight
env:
MATCH_DEPLOY_KEY: ${{ secrets.APPLE_APPS_MATCH_DEPLOY_KEY }}
FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APPS_APPLICATION_SPECIFIC_PASSWORD }}
MATCH_GIT_URL: ${{ secrets.APPLE_APPS_MATCH_GIT_URL }}
MATCH_PASSWORD: ${{ secrets.APPLE_APPS_MATCH_ENCRYPTION_PASSPHRASE }}
FASTLANE_XCODE_LIST_TIMEOUT: 100
FASTLANE_XCODEBUILD_SETTINGS_RETRIES: 6
54 changes: 54 additions & 0 deletions Examples/PublisherExampleSwiftUI/fastlane/Fastfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
default_platform(:ios)
platform :ios do
desc "Build and upload the Publisher Example app to TestFlight"
lane :build_and_upload_to_testflight do
# Creates a temporary keychain. Without this, the build could
# freeze and never finish. https://docs.fastlane.tools/actions/setup_ci/
setup_ci if ENV['CI']
# We want to leave the default config as Automatic code signing, since it's easier
# to use for users. So instead of changing those settings in pbxproj, we're using the
# `update_code_signing_settings` step.
update_code_signing_settings(
use_automatic_signing: false,
path: "PublisherExampleSwiftUI.xcodeproj",
team_id: "XXY98AVDR6",
code_sign_identity: "iPhone Distribution",
profile_name: "match appstore com.ably.tracking.example.publisher")
update_build_number
match(
git_url: ENV["MATCH_GIT_URL"],
app_identifier: "com.ably.tracking.example.publisher",
type: "appstore",
readonly: true)
build_app(scheme: "PublisherExampleSwiftUI",
workspace: "PublisherExampleSwiftUI.xcworkspace",
configuration: "Release",
export_method: "app-store",
output_name: "PublisherExample.ipa",
clean: true,
include_bitcode: true)
# upload_to_testflight(
#skip_submission: true,
#skip_waiting_for_build_processing: true,
#apple_id: "6444406485",
#username: ENV["APPLE_APPS_USERNAME"],
# itc_provider:"XXY98AVDR6")
end

# Example output: 2022.12.1.1454
desc "Set build number based on current time"
private_lane :update_build_number do
build_number = Time.new.strftime("%Y.%m.%d.%H%M")
increment_build_number(build_number: build_number)
end

# Helper lane, not used by CI, but can be used on local machines
# to fetch currently used certificate and profile from match repo
# by running `bundle exec fastlane fetch_certificate`
desc "Fetch the distribution certificate and appstore provisioning profile from match git repo"
lane :fetch_certificate do
match(type: "appstore",
readonly: true,
app_identifier: com.ably.tracking.example.publisher)
end
end
33 changes: 17 additions & 16 deletions Examples/SubscriberExample/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,34 @@ default_platform(:ios)
type: "appstore",
readonly: true)
build_app(scheme: "SubscriberExample",
project: "SubscriberExample.xcodeproj",
configuration: "Release",
export_method: "app-store",
output_name: "SubscriberExample.ipa",
clean: true,
include_bitcode: true)
upload_to_testflight(
skip_submission: true,
skip_waiting_for_build_processing: true,
apple_id: "6444409821",
itc_provider:"XXY98AVDR6")
project: "SubscriberExample.xcodeproj",
configuration: "Release",
export_method: "app-store",
output_name: "SubscriberExample.ipa",
clean: true,
include_bitcode: true)
#upload_to_testflight(
#skip_submission: true,
#skip_waiting_for_build_processing: true,
#apple_id: "6444409821",
#username: ENV["APPLE_APPS_USERNAME"],
#itc_provider:"XXY98AVDR6")
end

# Example output: 2022.12.1.1454
desc "Set build number based on current time"
private_lane :update_build_number do
build_number = Time.new.strftime("%Y.%m.%d.%H%M")
increment_build_number(
build_number: build_number,
xcodeproj: "SubscriberExample.xcodeproj")
build_number = Time.new.strftime("%Y.%m.%d.%H%M")
increment_build_number(build_number: build_number)
end

# Helper lane, not used by CI, but can be used on local machines
# to fetch currently used certificate and profile from match repo
# by running `bundle exec fastlane fetch_certificate`
desc "Fetch the distribution certificate and appstore provisioning profile from match git repo"
lane :fetch_certificate do
match(type: "appstore", readonly: true)
match(type: "appstore",
readonly: true,
app_identifier: com.ably.tracking.example.subscriber)
end
end
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ GEM
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.2.0)
aws-partitions (1.669.0)
aws-sdk-core (3.168.2)
aws-partitions (1.672.0)
aws-sdk-core (3.168.3)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.5)
Expand Down Expand Up @@ -214,11 +214,11 @@ GEM
sqlite3 (~> 1.3)
xcinvoke (~> 0.3.0)
jmespath (1.6.2)
json (2.6.2)
json (2.6.3)
jwt (2.5.0)
liferaft (0.0.6)
memoist (0.16.2)
mini_magick (4.11.0)
mini_magick (4.12.0)
mini_mime (1.1.2)
mini_portile2 (2.8.0)
minitest (5.16.3)
Expand Down

0 comments on commit fce1272

Please sign in to comment.