Skip to content

Commit

Permalink
[eas-cli] add target-profile and source-profile flags to `eas bui…
Browse files Browse the repository at this point in the history
…ld:resign` (#2410)

* [eas-cli] add `target-profile` and `source-profile` flags to `eas build:resign`

* update CHANGELOG.md

* fix target profile description
  • Loading branch information
szdziedzic authored Jun 6, 2024
1 parent e83565c commit 2a1fd29
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 27 additions & 7 deletions packages/eas-cli/src/commands/build/resign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ interface BuildResignFlags {
offset?: number;
limit?: number;
platform?: Platform;
profile?: string;
targetProfile?: string;
sourceProfile?: string;
maybeBuildId?: string;
wait: boolean;
}
Expand All @@ -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;
}
Expand All @@ -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({
Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -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,
};
Expand All @@ -242,13 +259,15 @@ export default class BuildResign extends EasCommand {
nonInteractive,
limit,
offset,
buildProfile,
}: {
graphqlClient: ExpoGraphqlClient;
projectId: string;
platform: Platform;
nonInteractive: boolean;
limit?: number;
offset?: number;
buildProfile?: string;
},
maybeBuild?: BuildFragment
): Promise<BuildFragment> {
Expand All @@ -268,6 +287,7 @@ export default class BuildResign extends EasCommand {
distribution: DistributionType.Internal,
platform: toAppPlatform(platform),
status: BuildStatus.Finished,
buildProfile,
},
});
if (!build) {
Expand Down

0 comments on commit 2a1fd29

Please sign in to comment.