Skip to content

Commit

Permalink
ENG-14518 Add keystoreName field to build profile
Browse files Browse the repository at this point in the history
  • Loading branch information
khamilowicz committed Dec 20, 2024
1 parent 2a96d04 commit 2cdaa18
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ This is the log of notable changes to EAS CLI and related packages.
### 🎉 New features

- Add `eas deploy --dry-run` flag to output tarball. ([#2761](https://github.com/expo/eas-cli/pull/2761) by [@kitten](https://github.com/kitten))
- Allow specifying credentials for android builds. ([#2775](https://github.com/expo/eas-cli/pull/2775) by [@khamilowicz](https://github.com/khamilowicz))

### 🐛 Bug fixes

Expand Down
1 change: 1 addition & 0 deletions packages/eas-cli/src/build/android/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ async function ensureAndroidCredentialsAsync(
ctx.android.gradleContext
);
const provider = new AndroidCredentialsProvider(ctx.credentialsCtx, {
name: ctx.buildProfile.keystoreName,
app: {
account: nullthrows(
ctx.user.accounts.find(a => a.name === ctx.accountName),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface AndroidCredentials {

interface Options {
app: AppLookupParams;
name?: string;
}

export default class AndroidCredentialsProvider {
Expand All @@ -37,7 +38,7 @@ export default class AndroidCredentialsProvider {
}

private async getRemoteAsync(): Promise<AndroidCredentials> {
const setupBuildCredentialsAction = new SetUpBuildCredentials({ app: this.options.app });
const setupBuildCredentialsAction = new SetUpBuildCredentials(this.options);
const buildCredentials = await setupBuildCredentialsAction.runAsync(this.ctx);
return this.toAndroidCredentials(buildCredentials);
}
Expand Down
27 changes: 27 additions & 0 deletions packages/eas-json/src/__tests__/buildProfiles-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,33 @@ test('valid eas.json with specified environment', async () => {
});
});

test('valid eas.json with specified keystoreName', async () => {
const keystoreName = 'this-is-a-keystore-name';
await fs.writeJson('/project/eas.json', {
build: {
development: {
android: {
credentialsSource: 'remote',
keystoreName,
},
},
},
});

const accessor = EasJsonAccessor.fromProjectPath('/project');
const androidProfile = await EasJsonUtils.getBuildProfileAsync(
accessor,
Platform.ANDROID,
'development'
);

expect(androidProfile).toEqual(
expect.objectContaining({
keystoreName,
})
);
});

test('valid eas.json with top level withoutCredentials property', async () => {
await fs.writeJson('/project/eas.json', {
build: {
Expand Down
8 changes: 8 additions & 0 deletions packages/eas-json/src/build/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ const AndroidBuildProfileSchema = PlatformBuildProfileSchema.concat(
Joi.boolean(),
Joi.string().valid('version', 'versionCode')
),

keystoreName: Joi.when('credentialsSource', {
is: 'remote',
then: Joi.string(),
otherwise: Joi.forbidden().messages({
'any.unknown': 'keystoreName is not allowed when credentialsSource is not remote',
}),
}),
})
);

Expand Down
2 changes: 2 additions & 0 deletions packages/eas-json/src/build/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ export interface AndroidBuildProfile extends PlatformBuildProfile {

// versions
autoIncrement?: AndroidVersionAutoIncrement;

keystoreName?: string;
}

export interface IosBuildProfile extends PlatformBuildProfile {
Expand Down

0 comments on commit 2cdaa18

Please sign in to comment.