Skip to content

Commit

Permalink
Merge pull request #360 from nimblehq/release/3.10.0
Browse files Browse the repository at this point in the history
Release - 3.10.0
  • Loading branch information
markgravity authored Sep 29, 2022
2 parents b8e8301 + ea7d811 commit 2b3e4a9
Show file tree
Hide file tree
Showing 16 changed files with 167 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/wiki/Deliverable-Configurations.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ The file [DeliverableConstants.rb](https://github.com/nimblehq/ios-templates/blo

- Developer can modify the `DeliverableConstants` at any time.
- Use the command `sh deliverable_setup.sh` to open `DeliverableConstants` with Xcode.
- Open the file manually at `fastlane/Constants/DeliverableConstants.rb` with any IDE.
- Open the file manually at `fastlane/Constants/DeliverableConstants.rb` with any IDE.
5 changes: 3 additions & 2 deletions .github/wiki/Github-Actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Make sure the following secrets are set up.
|------------------------|------------------------------------------------------------------------------------------------------------------------------------|----|---------------|-----------------------|-----------------------------------|
|SSH_PRIVATE_KEY |SSH key connected to a user with access to the match repo for check out the match repo. |- ||||
|MATCH_PASS |Fastlane Match Passphrase for decrypting a match repository. |- ||||
|APPSTORE_CONNECT_API_KEY|App Store Connect API https://docs.fastlane.tools/actions/app_store_connect_api_key/ for uploading build to TestFlight or App Store.|- |- |- ||
|APPSTORE_CONNECT_API_KEY|App Store Connect API https://docs.fastlane.tools/actions/app_store_connect_api_key/ for uploading build to TestFlight or App Store. Should be `base64` encoded.|- |- |- ||
|FIREBASE_TOKEN |Firebase token https://firebase.google.com/docs/cli#cli-ci-systems for uploading build to Firebase Distributions and Analytics. |- |||✅ For uploading dSYM to Crashlytics|

## Installation
Expand All @@ -61,5 +61,6 @@ Make sure the following secrets are set up.
2. Modify the files with project's values:
- fastlane/Matchfile
- fastlane/Constants/Constants.rb
3. Provide SECRETS noted in `yml` file in [Github Project's Setting](https://docs.github.com/en/actions/reference/encrypted-secrets)
3. Get APPSTORE_CONNECT_API_KEY base64 from AuthKey file (.p8) with `cat AuthKey_ABCDEFGH.p8 | base64`.
4. Provide SECRETS noted in `yml` file in [Github Project's Setting](https://docs.github.com/en/actions/reference/encrypted-secrets)
4. Push changes to Github
2 changes: 1 addition & 1 deletion .github/workflows/deploy_AppStore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
fetch-depth: 0

- name: Install SSH key
uses: webfactory/ssh-agent@v0.4.1
uses: webfactory/ssh-agent@v0.5.4
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy_Firebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
fetch-depth: 0

- name: Install SSH key
uses: webfactory/ssh-agent@v0.4.1
uses: webfactory/ssh-agent@v0.5.4
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy_Release_Firebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
fetch-depth: 0

- name: Install SSH key
uses: webfactory/ssh-agent@v0.4.1
uses: webfactory/ssh-agent@v0.5.4
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/test_upload_build_to_test_flight.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Test Upload Build to TestFlight

# SECRETS needed:
### SSH_PRIVATE_KEY for Match Repo
### MATCH_REPO
### MATCH_PASS
### API_KEY_ID
### ISSUER_ID
### APPSTORE_CONNECT_API_KEY

on:
pull_request

jobs:
build:
name: Build
runs-on: macOS-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- name: Checkout Repo
uses: actions/checkout@v2
with:
fetch-depth: 0

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

- name: Bundle install
run: bundle install

- name: Cache Pods
uses: actions/cache@v2
id: cocoapodCache
with:
path: Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Start Install Script for Template App
run: sh make.sh --bundle-id co.nimblehq.ios.templates --bundle-id-staging co.nimblehq.ios.templates.staging --project-name TemplateApp

- name: Start Setup Script for Template App TestFlight Upload
run: sh set_up_test_testflight.sh
env:
MATCH_REPO: ${{ secrets.MATCH_REPO }}
API_KEY_ID: ${{ secrets.API_KEY_ID }}
ISSUER_ID: ${{ secrets.ISSUER_ID }}

- name: Set Up Test Project for App Store
run: bundle exec fastlane set_up_test_project

- name: Update Provision Profile
run: bundle exec fastlane update_provision_settings
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASS }}

- name: Build App and Distribute to AppStore
run: bundle exec fastlane build_and_upload_appstore_app
env:
APPSTORE_CONNECT_API_KEY: ${{ secrets.APPSTORE_CONNECT_API_KEY }}
SKIP_FIREBASE_DSYM: "true"
BUMP_APP_STORE_BUILD_NUMBER: "true"
2 changes: 1 addition & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,5 @@ custom_rules:
multiline_arguments_one_per_line:
name: 'Multiline Arguments One Per Line'
message: 'Arguments should be either on the same line, or one per line.'
regex: '[^\n\r]\(\n([^\(])*([^\n\r],([^\n\r])*[\w]+)([^\)])*\n(\s)*\)'
regex: '[^\n\r]\(\n([^\(<])*([^\n\r],([^\n\r])*[\w]+)([^\)])*\n(\s)*\)'
severity: warning
5 changes: 0 additions & 5 deletions fastlane/Constants/Constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ def self.KEYCHAIN_PASSWORD
### ARCHIVING ###
#################

# a developer portal team id
def self.DEV_PORTAL_TEAM_ID
'{PROJECT_TEAM_ID}'
end

# an staging environment scheme name
def self.SCHEME_NAME_STAGING
'{PROJECT_NAME} Staging'
Expand Down
8 changes: 8 additions & 0 deletions fastlane/Constants/Environments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,12 @@ def self.APPSTORE_CONNECT_API_KEY
def self.MANUAL_VERSION
ENV['MANUAL_VERSION']
end

def self.SKIP_FIREBASE_DSYM
ENV['SKIP_FIREBASE_DSYM']
end

def self.BUMP_APP_STORE_BUILD_NUMBER
ENV['BUMP_APP_STORE_BUILD_NUMBER']
end
end
30 changes: 23 additions & 7 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -174,19 +174,25 @@ platform :ios do
desc 'Build and upload Production app to App Store'
lane :build_and_upload_appstore_app do
set_app_version
bump_build
set_connect_api_key if is_ci
if (Environments.BUMP_APP_STORE_BUILD_NUMBER || '') == 'true'
bump_appstore_build(app_identifier: Constants.BUNDLE_ID_PRODUCTION)
else
bump_build
end
builder.build_app_store(
Constants.SCHEME_NAME_PRODUCTION,
Constants.PRODUCT_NAME_PRODUCTION,
Constants.BUNDLE_ID_PRODUCTION,
true
)
set_connect_api_key if is_ci
upload_build_to_appstore
upload_build_dsym_to_firebase(
product_name: Constants.PRODUCT_NAME_PRODUCTION,
gsp_name: DeliverableConstants.GSP_PRODUCTION
)
if (Environments.SKIP_FIREBASE_DSYM || '') == ''
upload_build_dsym_to_firebase(
product_name: Constants.PRODUCT_NAME_PRODUCTION,
gsp_name: DeliverableConstants.GSP_PRODUCTION
)
end
end

desc 'upload develop build to App Store'
Expand All @@ -202,7 +208,8 @@ platform :ios do
app_store_connect_api_key(
key_id: DeliverableConstants.APP_STORE_KEY_ID,
issuer_id: DeliverableConstants.APP_STORE_ISSUER_ID,
key_content: Environments.APPSTORE_CONNECT_API_KEY || ''
key_content: Environments.APPSTORE_CONNECT_API_KEY || '',
is_key_content_base64: true
)
end

Expand All @@ -226,6 +233,15 @@ platform :ios do
)
end

desc 'set build number with App Store latest build'
private_lane :bump_appstore_build do |options|
increment_build_number({
build_number: latest_testflight_build_number(
app_identifier: options[:app_identifier]
) + 1
})
end

# Utilities

desc 'Clean up derived data'
Expand Down
1 change: 0 additions & 1 deletion fastlane/Gymfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

clean(true)
export_team_id(Constants.DEV_PORTAL_TEAM_ID)
output_directory(Constants.BUILD_PATH) # .ipa
build_path(Constants.BUILD_PATH) # .xcarchive is stored
derived_data_path(Constants.DERIVED_DATA_PATH) # .app
4 changes: 2 additions & 2 deletions fastlane/Managers/BuildManager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def build_ad_hoc(scheme, product_name, bundle_identifier)
export_method: 'ad-hoc',
export_options: {
provisioningProfiles: {
@bundle_identifier.to_s => "match AdHoc #{bundle_identifier}"
bundle_identifier => "match AdHoc #{bundle_identifier}"
}
},
include_bitcode: false,
Expand All @@ -26,7 +26,7 @@ def build_app_store(scheme, product_name, bundle_identifier, include_bitcode)
export_method: 'app-store',
export_options: {
provisioningProfiles: {
@bundle_identifier_staging.to_s => "match AppStore #{bundle_identifier}"
bundle_identifier => "match AppStore #{bundle_identifier}"
}
},
include_bitcode: include_bitcode,
Expand Down
41 changes: 41 additions & 0 deletions fastlane/Tests/Fastfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# frozen_string_literal: true

require './Constants/Constants'
require './Constants/Environments'
require './Managers/MatchManager'

match_manager = MatchManager.new(
fastlane: self,
keychain_name: Constants.KEYCHAIN_NAME,
keychain_password: Constants.KEYCHAIN_PASSWORD,
is_ci: Environments.CI,
username: ''
)

private_lane :template_app_icon do
appicon(
appicon_image_file: 'fastlane/Tests/appicon.png',
appicon_devices: %i[iphone ios_marketing],
appicon_path: '{PROJECT_NAME}/Resources/Assets/Assets.xcassets'
)
end

private_lane :disable_exempt_encryption do
set_info_plist_value(path: "{PROJECT_NAME}/Configurations/Plists/Info.plist", key: "ITSAppUsesNonExemptEncryption", value: false)
end

lane :set_up_test_project do
template_app_icon
disable_exempt_encryption
end

desc 'Sync AppStore match signing'
lane :update_provision_settings do
match_manager.sync_app_store_signing(app_identifier: [Constants.BUNDLE_ID_PRODUCTION])
update_code_signing_settings(
use_automatic_signing: false,
team_id: ENV["sigh_#{Constants.BUNDLE_ID_PRODUCTION}_appstore_team-id"],
profile_name: ENV["sigh_#{Constants.BUNDLE_ID_PRODUCTION}_appstore_profile-name"],
code_sign_identity: 'iPhone Distribution'
)
end
Binary file added fastlane/Tests/appicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ rm -f .git/index
git reset

if [[ -z "${CI}" ]]; then
rm -rf fastlane/Tests
rm -f set_up_test_testflight.sh
sh deliverable_setup.sh
fi

Expand Down
14 changes: 14 additions & 0 deletions set_up_test_testflight.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
echo "import('./Tests/Fastfile')" | cat - fastlane/Fastfile | tee fastlane/Fastfile &> /dev/null

bundle exec fastlane add_plugin appicon

readonly CONSTANT_API_KEY_ID="<#API_KEY_ID#>"
readonly CONSTANT_ISSUER_ID="<#ISSUER_ID#>"
readonly CONSTANT_MATCH_REPO="[email protected]:{organization}\/{repo}.git"

readonly WORKING_DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
MATCH_REPO_ESCAPED=$(echo "${MATCH_REPO//\//\\\/}")

LC_ALL=C find $WORKING_DIR -type f -exec sed -i "" "s/$CONSTANT_API_KEY_ID/$API_KEY_ID/g" {} +
LC_ALL=C find $WORKING_DIR -type f -exec sed -i "" "s/$CONSTANT_ISSUER_ID/$ISSUER_ID/g" {} +
LC_ALL=C find $WORKING_DIR -type f -exec sed -i "" "s/$CONSTANT_MATCH_REPO/$MATCH_REPO_ESCAPED/g" {} +

0 comments on commit 2b3e4a9

Please sign in to comment.