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

[eas-cli] Always refresh provisioning profile #2125

Merged
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 @@ -11,6 +11,7 @@ This is the log of notable changes to EAS CLI and related packages.
### 🐛 Bug fixes

- Don't ask a user to install the dev client if running in non-interactive mode. ([#2124](https://github.com/expo/eas-cli/pull/2124) by [@szdziedzic](https://github.com/szdziedzic))
- Always refresh existing provisioning profile before use. ([#2125](https://github.com/expo/eas-cli/pull/2125) by [@radoslawkrzemien](https://github.com/radoslawkrzemien))

### 🧹 Chores

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import nullthrows from 'nullthrows';
import DeviceCreateAction, { RegistrationMethod } from '../../../devices/actions/create/action';
import {
AppleAppIdentifierFragment,
AppleDevice,
AppleDeviceFragment,
AppleDistributionCertificateFragment,
AppleProvisioningProfileFragment,
Expand Down Expand Up @@ -147,15 +146,14 @@ export class SetUpAdhocProvisioningProfile {
app,
appleTeam
);
let appleProvisioningProfile: AppleProvisioningProfileFragment | null = null;
let appleProvisioningProfile: AppleProvisioningProfileFragment | null;
if (currentBuildCredentials?.provisioningProfile) {
appleProvisioningProfile = await this.reuseCurrentProvisioningProfileAsync(
currentBuildCredentials.provisioningProfile,
provisioningProfileStoreInfo,
ctx,
app,
appleAppIdentifier,
chosenDevices
appleAppIdentifier
);
} else {
appleProvisioningProfile = await ctx.ios.createProvisioningProfileAsync(
Expand Down Expand Up @@ -202,8 +200,7 @@ export class SetUpAdhocProvisioningProfile {
provisioningProfileStoreInfo: ProvisioningProfile,
ctx: CredentialsContext,
app: AppLookupParams,
appleAppIdentifier: AppleAppIdentifierFragment,
chosenDevices: AppleDevice[]
appleAppIdentifier: AppleAppIdentifierFragment
): Promise<AppleProvisioningProfileFragment> {
if (
currentProvisioningProfile.developerPortalIdentifier !==
Expand All @@ -222,10 +219,8 @@ export class SetUpAdhocProvisioningProfile {
developerPortalIdentifier: provisioningProfileStoreInfo.provisioningProfileId,
}
);
} else if (
differenceBy(chosenDevices, currentProvisioningProfile.appleDevices, 'identifier').length > 0
) {
// If IDs match, but the devices lists don't, the profile needs to be updated first
} else {
// If not, the profile needs to be updated first
return await ctx.ios.updateProvisioningProfileAsync(
ctx.graphqlClient,
currentProvisioningProfile.id,
Expand All @@ -234,9 +229,6 @@ export class SetUpAdhocProvisioningProfile {
developerPortalIdentifier: provisioningProfileStoreInfo.provisioningProfileId,
}
);
} else {
// Otherwise the current profile can be reused
return currentProvisioningProfile;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ describe('runWithDistributionCertificateAsync', () => {
developerPortalIdentifier: 'provisioningProfileId',
},
} as IosAppBuildCredentialsFragment);
ctx.ios.updateProvisioningProfileAsync = jest.fn().mockResolvedValue({
appleTeam: {},
appleDevices: [{ identifier: 'id1' }, { identifier: 'id2' }, { identifier: 'id3' }],
developerPortalIdentifier: 'provisioningProfileId',
});
const LogWarnSpy = jest.spyOn(Log, 'warn');
const LogLogSpy = jest.spyOn(Log, 'log');
const result = await setUpAdhocProvisioningProfile.runWithDistributionCertificateAsync(
Expand Down
Loading