Skip to content

Commit

Permalink
feat(flagship): deprecate appcenter.apiconfig configuration option
Browse files Browse the repository at this point in the history
This deprecates the appcenter.apiConfig configuration option in favor of using the APPCENTER_API_TOKEN environment variable. This makes the key optional in the typedef and updates the Fastfiles for iOS and Android such that not including this option will not break the builds.
  • Loading branch information
bweissbart authored and deemaabdallah committed Nov 20, 2019
1 parent d84d831 commit 55c4b61
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/flagship/android/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ lane :appcenter do
gradle(task: "assembleRelease")

appcenter_upload(
api_token: "INJECTED_FROM_CONFIG", #PROJECT_MODIFY_FLAG_appcenter_api_token
#PROJECT_MODIFY_FLAG_appcenter_api_token
owner_name: "INJECTED_FROM_CONFIG", #PROJECT_MODIFY_FLAG_appcenter_owner_name
app_name: "INJECTED_FROM_CONFIG" #PROJECT_MODIFY_FLAG_appcenter_app_name_android
)
Expand Down
2 changes: 1 addition & 1 deletion packages/flagship/ios/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ lane :appcenter do
)

appcenter_upload(
api_token: "INJECTED_FROM_CONFIG", #PROJECT_MODIFY_FLAG_appcenter_api_token
#PROJECT_MODIFY_FLAG_appcenter_api_token
owner_name: "INJECTED_FROM_CONFIG", #PROJECT_MODIFY_FLAG_appcenter_owner_name
app_name: "INJECTED_FROM_CONFIG" #PROJECT_MODIFY_FLAG_appcenter_app_name_ios
)
Expand Down
19 changes: 13 additions & 6 deletions packages/flagship/src/lib/fastlane.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Config } from '../types';
import * as fs from './fs';
import { logInfo } from '../helpers';
import { logInfo, logWarn } from '../helpers';

/**
* Configures the project Fastfile from the project configuration.
Expand Down Expand Up @@ -67,11 +67,18 @@ export function configure(path: string, configuration: Config): void {
if (configuration && configuration.appCenter) {
const { apiToken, organization, distribute } = configuration.appCenter;

fs.update(
path,
/.+#PROJECT_MODIFY_FLAG_appcenter_api_token/g,
`api_token: "${apiToken}", #PROJECT_MODIFY_FLAG_appcenter_api_token`
);
if (apiToken) {
logWarn(
'appCenter.apiToken is deprecated and will be removed in a future release;'
+ ' use APPCENTER_API_TOKEN environment variable instead'
);

fs.update(
path,
/.+#PROJECT_MODIFY_FLAG_appcenter_api_token/g,
`api_token: "${apiToken}", #PROJECT_MODIFY_FLAG_appcenter_api_token`
);
}

fs.update(
path,
Expand Down
2 changes: 1 addition & 1 deletion packages/flagship/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface Config {
};

appCenter?: {
apiToken: string;
apiToken?: string; // deprecated; will be removed in a future release
organization: string;
distribute?: {
appNameIOS?: string;
Expand Down

0 comments on commit 55c4b61

Please sign in to comment.