Skip to content

Commit

Permalink
refactor(fastlane-env): Code review changes for Production deployments
Browse files Browse the repository at this point in the history
Implement changes so that prod deployment only deploys to one place (following BAM's standards)
  • Loading branch information
felixmeziere committed Apr 16, 2019
1 parent 64d6d3e commit 956ce77
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 24 deletions.
9 changes: 2 additions & 7 deletions generators/fastlane-env/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,24 +183,19 @@ class FastlaneEnvGenerator extends Base {
message: 'A valid App Center Username',
when: answers => answers.deploymentPlatform === 'appcenter',
},
{
type: 'confirm',
name: 'deployToProduction',
message: 'Will this environment deploy to production?',
},
{
type: 'input',
name: 'appstoreConnectAppleId',
message:
'An AppstoreConnect Apple Id (make sure the ID has "developer" acces - only allowed to upload builds). Can be entered later in fastlane/env.<environment>',
when: answers => answers.deployToProduction,
when: answers => answers.appstore,
},
{
type: 'input',
name: 'androidPlayStoreJsonKeyPath',
message:
'A Google Play JSON Key relative path. Can be entered later in fastlane/env.<environment>',
when: answers => answers.deployToProduction,
when: answers => answers.appstore,
},
{
type: 'confirm',
Expand Down
4 changes: 2 additions & 2 deletions generators/fastlane-env/templates/fastlane/env
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ IOS_TEAM_ID='<%= appleTeamId %>'
IOS_USER_ID='<%= appleId %>'
IOS_PLIST_PATH='<%= projectName %>/Info.plist'
<% if (deploymentPlatform === 'appstore') { %>IOS_ITC_TEAM_NAME='<%= itunesTeamName %>'<% } %>
<% if (deployToProduction) { %>IOS_APPSTORECONNECT_USER_ID='<%= appstoreConnectAppleId %>'<% } %>
<% if (appstore) { %>IOS_APPSTORECONNECT_USER_ID='<%= appstoreConnectAppleId %>'<% } %>

### IOS MATCH ###
MATCH_GIT_URL='<%= matchGit %>'
Expand All @@ -38,7 +38,7 @@ GRADLE_APP_NAME='<%= appName %>'
<% if (deploymentPlatform === 'appcenter') { %>ANDROID_APPCENTER_APP_ID='<%= androidAppCenterId %>'<% } %>
GRADLE_KEYSTORE='<%= lowerCaseProjectName %>.<%= environmentName %>.keystore'
GRADLE_KEYSTORE_ALIAS='<%= lowerCaseProjectName %>'
<% if (deployToProduction) { %>ANDROID_PLAYSTORE_JSON_KEY_PATH='<%= androidPlayStoreJsonKeyPath %>'<% } %>
<% if (appstore) { %>ANDROID_PLAYSTORE_JSON_KEY_PATH='<%= androidPlayStoreJsonKeyPath %>'<% } %>

### CODEPUSH ###
<% if (useCodePush) { %>IOS_CODEPUSH_DEPLOYMENT_NAME='<%= iosCodePushDeploymentName %>'<% } %>
Expand Down
22 changes: 7 additions & 15 deletions generators/fastlane-setup/templates/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,8 @@ platform :ios do
username: ENV['IOS_APPSTORECONNECT_USER_ID'],
app_identifier: ENV['IOS_APP_ID'],
ipa: ENV['IOS_IPA_PATH'],
distribute_external: true,
reject_build_waiting_for_review: true,
changelog: 'New features and bug fixes.'
distribute_external: false,
skip_waiting_for_build_processing: true
)
end

Expand All @@ -173,13 +172,7 @@ platform :ios do
deploy_hockey
elsif ENV['DEPLOYMENT_PLATFORM'] === 'appcenter' then
upload_to_appcenter
else
pilot(
distribute_external: false,
skip_waiting_for_build_processing: true
)
end
if ENV['IOS_APPSTORECONNECT_USER_ID'] then
elsif ENV['DEPLOYMENT_PLATFORM'] === 'appstore'
upload_to_testflight
end
end
Expand Down Expand Up @@ -271,10 +264,10 @@ platform :android do
)
end

lane :upload_to_playstore_alpha do |options|
lane :upload_to_playstore do |options|
supply(
package_name: ENV['GRADLE_APP_IDENTIFIER'],
track: 'alpha',
track: 'internal',
apk: ENV['ANDROID_APK_PATH'],
json_key: ENV['ANDROID_PLAYSTORE_JSON_KEY_PATH'],
)
Expand All @@ -291,9 +284,8 @@ platform :android do
deploy_hockey
elsif ENV['DEPLOYMENT_PLATFORM'] === 'appcenter' then
upload_to_appcenter
end
if ENV['ANDROID_PLAYSTORE_JSON_KEY_PATH'] then
upload_to_playstore_alpha
elsif ENV['DEPLOYMENT_PLATFORM'] === 'appstore' then
upload_to_playstore
end
end
end
Expand Down

0 comments on commit 956ce77

Please sign in to comment.