Skip to content

Commit

Permalink
Merge pull request #211 from felixmeziere/add-production-deployments
Browse files Browse the repository at this point in the history
feat(fastlane-env): Add production deployments
  • Loading branch information
felixmeziere authored Apr 17, 2019
2 parents 38bc600 + 956ce77 commit 1ed556c
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 9 deletions.
14 changes: 14 additions & 0 deletions generators/fastlane-env/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,20 @@ class FastlaneEnvGenerator extends Base {
message: 'A valid App Center Username',
when: answers => answers.deploymentPlatform === 'appcenter',
},
{
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.appstore,
},
{
type: 'input',
name: 'androidPlayStoreJsonKeyPath',
message:
'A Google Play JSON Key relative path. Can be entered later in fastlane/env.<environment>',
when: answers => answers.appstore,
},
{
type: 'confirm',
name: 'useCodePush',
Expand Down
2 changes: 2 additions & 0 deletions generators/fastlane-env/templates/fastlane/env
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +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 (appstore) { %>IOS_APPSTORECONNECT_USER_ID='<%= appstoreConnectAppleId %>'<% } %>

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

### CODEPUSH ###
<% if (useCodePush) { %>IOS_CODEPUSH_DEPLOYMENT_NAME='<%= iosCodePushDeploymentName %>'<% } %>
Expand Down
37 changes: 28 additions & 9 deletions generators/fastlane-setup/templates/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ platform :ios do
)
end

lane :deploy_appCenter do |options|
lane :upload_to_appcenter do |options|
appcenter_upload(
api_token: ENV['FL_APPCENTER_API_TOKEN'],
owner_name: ENV['APPCENTER_USERNAME'],
Expand All @@ -146,6 +146,16 @@ platform :ios do
)
end

lane :upload_to_testflight do |options|
pilot(
username: ENV['IOS_APPSTORECONNECT_USER_ID'],
app_identifier: ENV['IOS_APP_ID'],
ipa: ENV['IOS_IPA_PATH'],
distribute_external: false,
skip_waiting_for_build_processing: true
)
end

lane :deploy do |options|
set_js_env
if options[:codepush] then
Expand All @@ -161,12 +171,9 @@ platform :ios do
if ENV['DEPLOYMENT_PLATFORM'] === 'hockeyapp' then
deploy_hockey
elsif ENV['DEPLOYMENT_PLATFORM'] === 'appcenter' then
deploy_appCenter
else
pilot(
distribute_external: false,
skip_waiting_for_build_processing: true
)
upload_to_appcenter
elsif ENV['DEPLOYMENT_PLATFORM'] === 'appstore'
upload_to_testflight
end
end
end
Expand Down Expand Up @@ -247,7 +254,7 @@ platform :android do
)
end

lane :deploy_appCenter do |options|
lane :upload_to_appcenter do |options|
appcenter_upload(
api_token: ENV['FL_APPCENTER_API_TOKEN'],
owner_name: ENV['APPCENTER_USERNAME'],
Expand All @@ -257,6 +264,15 @@ platform :android do
)
end

lane :upload_to_playstore do |options|
supply(
package_name: ENV['GRADLE_APP_IDENTIFIER'],
track: 'internal',
apk: ENV['ANDROID_APK_PATH'],
json_key: ENV['ANDROID_PLAYSTORE_JSON_KEY_PATH'],
)
end

lane :deploy do |options|
set_js_env
if options[:codepush] then
Expand All @@ -267,7 +283,9 @@ platform :android do
if ENV['DEPLOYMENT_PLATFORM'] === 'hockeyapp' then
deploy_hockey
elsif ENV['DEPLOYMENT_PLATFORM'] === 'appcenter' then
deploy_appCenter
upload_to_appcenter
elsif ENV['DEPLOYMENT_PLATFORM'] === 'appstore' then
upload_to_playstore
end
end
end
Expand All @@ -276,4 +294,5 @@ platform :android do
check_git_status(name: ENV['REPO_GIT_BRANCH'])
deploy
end

end

0 comments on commit 1ed556c

Please sign in to comment.