Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENG-14518 Add keystoreName field to build profile #2775

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,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
Loading