Skip to content

Commit

Permalink
fix(fastlane-env): Fixes to .env generation for production deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
felixmeziere committed Apr 24, 2019
1 parent c2bbc5b commit 88cb372
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
10 changes: 9 additions & 1 deletion generators/circleci/index.js
Expand Up @@ -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
);
Expand Down
2 changes: 1 addition & 1 deletion generators/fastlane-env/index.js
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions generators/fastlane-env/templates/fastlane/env
Expand Up @@ -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 %>'
Expand All @@ -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 %>'<% } %>
Expand Down
2 changes: 1 addition & 1 deletion generators/fastlane-env/templates/fastlane/env.secret
Expand Up @@ -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 %>'<% } %>
Expand Down
1 change: 1 addition & 0 deletions generators/fastlane-setup/templates/fastlane/Fastfile
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions generators/fastlane-setup/templates/gitignore
Expand Up @@ -6,3 +6,5 @@ fastlane/.env.*.secret
*.back
.bundle
vendor/bundle
*._api-*.json
*api-*.json

0 comments on commit 88cb372

Please sign in to comment.