diff --git a/packages/eas-cli/src/commands/credentials/configure-build.ts b/packages/eas-cli/src/commands/credentials/configure-build.ts index 24d7ca69db..6d26da79f2 100644 --- a/packages/eas-cli/src/commands/credentials/configure-build.ts +++ b/packages/eas-cli/src/commands/credentials/configure-build.ts @@ -2,6 +2,7 @@ import { Platform } from '@expo/eas-build-job'; import { Flags } from '@oclif/core'; import EasCommand from '../../commandUtils/EasCommand'; +import { SelectBuildProfileFromEasJson } from '../../credentials/manager/SelectBuildProfileFromEasJson'; import { SetUpBuildCredentialsCommandAction } from '../../credentials/manager/SetUpBuildCredentialsCommandAction'; import { selectPlatformAsync } from '../../platform'; @@ -17,13 +18,12 @@ export default class InitializeBuildCredentials extends EasCommand { char: 'e', description: 'The name of the build profile in eas.json.', helpValue: 'PROFILE_NAME', - required: true, }), }; static override contextDefinition = { ...this.ContextOptions.LoggedIn, - ...this.ContextOptions.OptionalProjectConfig, + ...this.ContextOptions.ProjectConfig, ...this.ContextOptions.DynamicProjectConfig, ...this.ContextOptions.Analytics, ...this.ContextOptions.Vcs, @@ -43,6 +43,13 @@ export default class InitializeBuildCredentials extends EasCommand { const platform = await selectPlatformAsync(flags.platform); + const buildProfile = + flags.profile ?? + (await new SelectBuildProfileFromEasJson( + privateProjectConfig.projectDir, + Platform.IOS + ).getProfileNameFromEasConfigAsync()); + await new SetUpBuildCredentialsCommandAction( actor, graphqlClient, @@ -51,7 +58,7 @@ export default class InitializeBuildCredentials extends EasCommand { privateProjectConfig ?? null, getDynamicPrivateProjectConfigAsync, platform, - flags.profile + buildProfile ).runAsync(); } }