From 88cb37214dd4311394daa9177e33986ff61716d9 Mon Sep 17 00:00:00 2001 From: Felix Meziere Date: Wed, 24 Apr 2019 12:46:46 +0100 Subject: [PATCH] fix(fastlane-env): Fixes to .env generation for production deployments --- generators/circleci/index.js | 10 +++++++++- generators/fastlane-env/index.js | 2 +- generators/fastlane-env/templates/fastlane/env | 6 +++--- generators/fastlane-env/templates/fastlane/env.secret | 2 +- generators/fastlane-setup/templates/fastlane/Fastfile | 1 + generators/fastlane-setup/templates/gitignore | 2 ++ 6 files changed, 17 insertions(+), 6 deletions(-) diff --git a/generators/circleci/index.js b/generators/circleci/index.js index 5ef512b..b50118f 100644 --- a/generators/circleci/index.js +++ b/generators/circleci/index.js @@ -157,12 +157,20 @@ class CircleGenerator extends Base { `Custom config.yml created. Re-run yo rn-toolbox:circleci anytime to re-generate the file with latest environments information.` .green.bold ); + this.log( + `Please make sure that CircleCI has access to your MATCH repo using 'Checkout ssh Keys' section in settings. Good practice: Github account should have readonly access and only to this repo.` + .magenta.bold + ); this.log( `Please make sure that all of the following environment variables have been added in the Circle-CI console's Environment Variables section:` .magenta.bold ); this.log( - ['FL_APPCENTER_API_TOKEN', 'MATCH_PASSWORD'] + [ + 'FL_APPCENTER_API_TOKEN', + 'MATCH_PASSWORD', + 'FASTLANE_PASSWORD (<- password of AppstoreConnect Apple ID)', + ] .concat(this.environments.map(getPassphraseAliasForEnvironment)) .join(', ').magenta.bold ); diff --git a/generators/fastlane-env/index.js b/generators/fastlane-env/index.js index 0843ab6..d1f57f1 100755 --- a/generators/fastlane-env/index.js +++ b/generators/fastlane-env/index.js @@ -200,7 +200,7 @@ class FastlaneEnvGenerator extends Base { type: 'input', name: 'androidAppCenterId', message: - 'The Android project id on AppCenter, should be different than iOS and not contain spaces', + 'The Android project id on AppCenter for this environment, should be different than iOS and not contain spaces', default: answers => `${answers.appName.replace(/ /g, '')}-android-${ answers.environmentName diff --git a/generators/fastlane-env/templates/fastlane/env b/generators/fastlane-env/templates/fastlane/env index 7792736..23e1b48 100644 --- a/generators/fastlane-env/templates/fastlane/env +++ b/generators/fastlane-env/templates/fastlane/env @@ -6,7 +6,7 @@ REPO_GIT_BRANCH='<%= repoGitBranch %>' ### IOS ### IOS_PROJECT_PATH='ios' IOS_APP_NAME='<%= appName %>' -<% if (deploymentPlatform === 'appcenter') { %>IOS_APPCENTER_APP_ID='<%= iosAppCenterId %>'<% } %> +<% if (deploymentPlatform === 'appcenter' || useCodePush) { %>IOS_APPCENTER_APP_ID='<%= iosAppCenterId %>'<% } %> IOS_PROJECT_NAME='<%= projectName %>' IOS_APP_ID='<%= appId %>' IOS_TEAM_ID='<%= appleTeamId %>' @@ -28,14 +28,14 @@ GYM_OUTPUT_NAME='app' ### IOS HOCKEY APP AND APP CENTER ### IOS_IPA_PATH='./dist/app.ipa' -<% if (deploymentPlatform === 'appcenter') { %>APPCENTER_USERNAME='<%= appCenterUsername %>'<% } %> +<% if (deploymentPlatform === 'appcenter' || useCodePush) { %>APPCENTER_USERNAME='<%= appCenterUsername %>'<% } %> ### ANDROID PROJECT ### ANDROID_PROJECT_DIR='android' ANDROID_APK_PATH='android/app/build/outputs/apk/release/app-release.apk' GRADLE_APP_IDENTIFIER='<%= appId %>' GRADLE_APP_NAME='<%= appName %>' -<% if (deploymentPlatform === 'appcenter') { %>ANDROID_APPCENTER_APP_ID='<%= androidAppCenterId %>'<% } %> +<% if (deploymentPlatform === 'appcenter' || useCodePush) { %>ANDROID_APPCENTER_APP_ID='<%= androidAppCenterId %>'<% } %> GRADLE_KEYSTORE='<%= lowerCaseProjectName %>.<%= environmentName %>.keystore' GRADLE_KEYSTORE_ALIAS='<%= lowerCaseProjectName %>' <% if (deploymentPlatform === 'appstore') { %>ANDROID_PLAYSTORE_JSON_KEY_PATH='<%= androidPlayStoreJsonKeyPath %>'<% } %> diff --git a/generators/fastlane-env/templates/fastlane/env.secret b/generators/fastlane-env/templates/fastlane/env.secret index d655692..bbfff7b 100644 --- a/generators/fastlane-env/templates/fastlane/env.secret +++ b/generators/fastlane-env/templates/fastlane/env.secret @@ -2,7 +2,7 @@ GRADLE_KEYSTORE_PASSWORD='<%= keystorePassword %>' GRADLE_KEYSTORE_ALIAS_PASSWORD='<%= keystorePassword %>' <% if (deploymentPlatform === 'hockeyapp') { %>FL_HOCKEY_API_TOKEN='<%= hockeyAppToken %>'<% } %> -<% if (deploymentPlatform === 'appcenter') { %>FL_APPCENTER_API_TOKEN='<%= appCenterToken %>'<% } %> +<% if (deploymentPlatform === 'appcenter' || useCodePush) { %>FL_APPCENTER_API_TOKEN='<%= appCenterToken %>'<% } %> <% if (useAppcenterSDK) { %>IOS_APPCENTER_APP_SECRET='<%= iosAppcenterAppSecret %>'<% } %> <% if (useAppcenterSDK) { %>ANDROID_APPCENTER_APP_SECRET='<%= androidAppcenterAppSecret %>'<% } %> diff --git a/generators/fastlane-setup/templates/fastlane/Fastfile b/generators/fastlane-setup/templates/fastlane/Fastfile index e95bf99..6dd3338 100644 --- a/generators/fastlane-setup/templates/fastlane/Fastfile +++ b/generators/fastlane-setup/templates/fastlane/Fastfile @@ -170,6 +170,7 @@ platform :ios do release_notes = %x[#{release_notes_command}] sh "cd .. && appcenter codepush release-react -d #{ENV['IOS_CODEPUSH_DEPLOYMENT_NAME']} -a #{ENV['APPCENTER_USERNAME']}/#{ENV['IOS_APPCENTER_APP_ID']} --target-binary-version \"#{ENV['IOS_VERSION']}\" --description \"#{release_notes}\" --disable-duplicate-release-error" else + setup_circle_ci match( shallow_clone: true, clone_branch_directly: true, diff --git a/generators/fastlane-setup/templates/gitignore b/generators/fastlane-setup/templates/gitignore index 90be3dc..9c5e2fa 100644 --- a/generators/fastlane-setup/templates/gitignore +++ b/generators/fastlane-setup/templates/gitignore @@ -6,3 +6,5 @@ fastlane/.env.*.secret *.back .bundle vendor/bundle +*._api-*.json +*api-*.json