From 2a1fd290b9220174a9c69e3146824d1e27cfadb5 Mon Sep 17 00:00:00 2001 From: Szymon Dziedzic Date: Thu, 6 Jun 2024 18:47:11 +0200 Subject: [PATCH] [eas-cli] add `target-profile` and `source-profile` flags to `eas build:resign` (#2410) * [eas-cli] add `target-profile` and `source-profile` flags to `eas build:resign` * update CHANGELOG.md * fix target profile description --- CHANGELOG.md | 1 + packages/eas-cli/src/commands/build/resign.ts | 34 +++++++++++++++---- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86cf57ad36..2a846cfe5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ This is the log of notable changes to EAS CLI and related packages. ### 🎉 New features +- Add `target-profile` and `source-profile` flags to the `eas build:resign` command. ([#2410](https://github.com/expo/eas-cli/pull/2410) by [@szdziedzic](https://github.com/szdziedzic)) - Display build profile in the output of `eas build:list`. ([#2408](https://github.com/expo/eas-cli/pull/2408) by [@szdziedzic](https://github.com/szdziedzic)) ### 🐛 Bug fixes diff --git a/packages/eas-cli/src/commands/build/resign.ts b/packages/eas-cli/src/commands/build/resign.ts index ee657aadf9..bf403c4dbe 100644 --- a/packages/eas-cli/src/commands/build/resign.ts +++ b/packages/eas-cli/src/commands/build/resign.ts @@ -42,7 +42,8 @@ interface BuildResignFlags { offset?: number; limit?: number; platform?: Platform; - profile?: string; + targetProfile?: string; + sourceProfile?: string; maybeBuildId?: string; wait: boolean; } @@ -52,7 +53,8 @@ interface RawBuildResignFlags { offset: number | undefined; limit: number | undefined; platform: 'android' | 'ios' | undefined; - profile: string | undefined; + 'target-profile': string | undefined; + 'source-profile': string | undefined; wait: boolean; id: string | undefined; } @@ -65,10 +67,16 @@ export default class BuildResign extends EasCommand { char: 'p', options: ['android', 'ios'], }), - profile: Flags.string({ + 'target-profile': Flags.string({ char: 'e', description: - 'Name of the build profile from eas.json. Defaults to "production" if defined in eas.json.', + 'Name of the target build profile from eas.json. Credentials and environment variables from this profile will be used when re-signing. Defaults to "production" if defined in eas.json.', + helpValue: 'PROFILE_NAME', + aliases: ['profile'], + }), + 'source-profile': Flags.string({ + description: + 'Name of the source build profile from eas.json. Used to filter builds eligible for re-signing.', helpValue: 'PROFILE_NAME', }), wait: Flags.boolean({ @@ -130,12 +138,20 @@ export default class BuildResign extends EasCommand { const buildProfile = await EasJsonUtils.getBuildProfileAsync( easJsonAccessor, platform, - flags.profile ?? 'production' + flags.targetProfile ?? 'production' ); const { exp, projectId } = await getDynamicPrivateProjectConfigAsync({ env: buildProfile.env }); const account = await getOwnerAccountForProjectIdAsync(graphqlClient, projectId); const build = await this.ensureBuildSelectedAsync( - { graphqlClient, projectId, platform, nonInteractive, limit, offset }, + { + graphqlClient, + projectId, + platform, + nonInteractive, + limit, + offset, + buildProfile: flags.sourceProfile, + }, maybeBuild ); const credentialsCtx = new CredentialsContext({ @@ -228,7 +244,8 @@ export default class BuildResign extends EasCommand { offset: flags.offset, limit: flags.limit, platform: flags.platform as Platform | undefined, - profile: flags.profile, + sourceProfile: flags['source-profile'], + targetProfile: flags['target-profile'], maybeBuildId: flags.id, wait: flags.wait, }; @@ -242,6 +259,7 @@ export default class BuildResign extends EasCommand { nonInteractive, limit, offset, + buildProfile, }: { graphqlClient: ExpoGraphqlClient; projectId: string; @@ -249,6 +267,7 @@ export default class BuildResign extends EasCommand { nonInteractive: boolean; limit?: number; offset?: number; + buildProfile?: string; }, maybeBuild?: BuildFragment ): Promise { @@ -268,6 +287,7 @@ export default class BuildResign extends EasCommand { distribution: DistributionType.Internal, platform: toAppPlatform(platform), status: BuildStatus.Finished, + buildProfile, }, }); if (!build) {