mirror of
https://github.com/expo/eas-cli.git
synced 2026-11-15 17:31:46 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8126b2276e | ||
|
|
e1de21015f | ||
|
|
61e505f1f8 | ||
|
|
2e3611161e | ||
|
|
95f5eaaacf | ||
|
|
87a3ea99e2 | ||
|
|
ddab65a55d | ||
|
|
0cf8f8ce0d | ||
|
|
2b531ec70c | ||
|
|
6cd7966904 | ||
|
|
ad72ab990f | ||
|
|
b53412fc00 |
No files matched your search
@@ -8,10 +8,36 @@ This is the log of notable changes to EAS CLI and related packages.
|
||||
|
||||
### 🎉 New features
|
||||
|
||||
- Implement offline distribution certificate validation when running a build in non-interactive mode. ([#344](https://github.com/expo/eas-cli/pull/344) by [@dsokal](https://github.com/dsokal))
|
||||
- Add support for building internal distribution apps for Apple Enterprise Teams. ([#344](https://github.com/expo/eas-cli/pull/344) by [@dsokal](https://github.com/dsokal))
|
||||
|
||||
### 🐛 Bug fixes
|
||||
|
||||
- Display descriptive error message when API for EAS Build changes. ([#359](https://github.com/expo/eas-cli/pull/359) by [@wkozyra95](https://github.com/wkozyra95))
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
## [0.12.0](https://github.com/expo/eas-cli/releases/tag/v0.12.0) - 2021-04-22
|
||||
|
||||
### 🎉 New features
|
||||
|
||||
- Add the initiating user's username to the build metadata. ([#354](https://github.com/expo/eas-cli/pull/354) by [@dsokal](https://github.com/dsokal))
|
||||
- Add `--clear-cache` flag for `eas build`. ([#355](https://github.com/expo/eas-cli/pull/355) by [@wkozyra95](https://github.com/wkozyra95))
|
||||
|
||||
### 🐛 Bug fixes
|
||||
|
||||
- Fix the bug where the account name was used as the username. ([#354](https://github.com/expo/eas-cli/pull/354) by [@dsokal](https://github.com/dsokal))
|
||||
|
||||
## [0.11.1](https://github.com/expo/eas-cli/releases/tag/v0.11.1) - 2021-04-20
|
||||
|
||||
### 🎉 New features
|
||||
|
||||
- Resolve ios distribution types. ([#348](https://github.com/expo/eas-cli/pull/348) by [@quinlanj](https://github.com/quinlanj))
|
||||
|
||||
### 🐛 Bug fixes
|
||||
|
||||
- Bump version of `@expo/apple-utils` to fix capabilities sync immediately after initial identifier registration. ([593c4](https://github.com/expo/eas-cli/commit/593c42f601396deba1751489343ec07b0a8876da) by [@brentvatne](https://github.com/brentvatne))
|
||||
|
||||
## [0.11.0](https://github.com/expo/eas-cli/releases/tag/v0.11.0) - 2021-04-20
|
||||
|
||||
### 🛠 Breaking changes
|
||||
|
||||
@@ -5,6 +5,26 @@
|
||||
1. Once the release is ready to go, you can go to https://github.com/expo/eas-cli/releases and mark it as not draft.
|
||||
- Remember to copy the changelog entries from `CHANGELOG.md`.
|
||||
1. Run `yarn lerna publish from-git` in the repository root folder. This will publish the packages to npm.
|
||||
|
||||
- This command works only if `HEAD` is on the release commit, e.g. when `git log -1` prints:
|
||||
|
||||
```
|
||||
commit cbb2de9e118bfbcb5a597b261d2dbef0bb5d4b0b (tag: v0.11.1)
|
||||
Author: Brent Vatne <[email protected]>
|
||||
Date: Tue Apr 20 15:00:15 2021 -0700
|
||||
|
||||
v0.11.1
|
||||
```
|
||||
|
||||
- If you run `yarn lerna publish from-git` on any other commit, it'll print something like:
|
||||
|
||||
```
|
||||
lerna notice from-git No tagged release found
|
||||
lerna success No changed packages to publish
|
||||
```
|
||||
|
||||
- If you ever run into the above issue, use `git checkout RELEASE_COMMIT_HASH` to checkout to the release commit. Later, when you've published the packages to npm, run `git checkout main` to go back to the latest commit.
|
||||
|
||||
1. Update `CHANGELOG.md`.
|
||||
- Add the new section with the release version in the title.
|
||||
- Leave the `main` section empty (without any changelog entries).
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true,
|
||||
"version": "0.11.1"
|
||||
"version": "0.13.0"
|
||||
}
|
||||
+26
-19
@@ -69,7 +69,7 @@ ALIASES
|
||||
$ eas login
|
||||
```
|
||||
|
||||
_See code: [build/commands/account/login.ts](https://github.com/expo/eas-cli/blob/v0.11.1/build/commands/account/login.ts)_
|
||||
_See code: [build/commands/account/login.ts](https://github.com/expo/eas-cli/blob/v0.13.0/build/commands/account/login.ts)_
|
||||
|
||||
## `eas account:logout`
|
||||
|
||||
@@ -83,7 +83,7 @@ ALIASES
|
||||
$ eas logout
|
||||
```
|
||||
|
||||
_See code: [build/commands/account/logout.ts](https://github.com/expo/eas-cli/blob/v0.11.1/build/commands/account/logout.ts)_
|
||||
_See code: [build/commands/account/logout.ts](https://github.com/expo/eas-cli/blob/v0.13.0/build/commands/account/logout.ts)_
|
||||
|
||||
## `eas account:view`
|
||||
|
||||
@@ -97,7 +97,7 @@ ALIASES
|
||||
$ eas whoami
|
||||
```
|
||||
|
||||
_See code: [build/commands/account/view.ts](https://github.com/expo/eas-cli/blob/v0.11.1/build/commands/account/view.ts)_
|
||||
_See code: [build/commands/account/view.ts](https://github.com/expo/eas-cli/blob/v0.13.0/build/commands/account/view.ts)_
|
||||
|
||||
## `eas analytics [STATUS]`
|
||||
|
||||
@@ -108,7 +108,7 @@ USAGE
|
||||
$ eas analytics [STATUS]
|
||||
```
|
||||
|
||||
_See code: [build/commands/analytics.ts](https://github.com/expo/eas-cli/blob/v0.11.1/build/commands/analytics.ts)_
|
||||
_See code: [build/commands/analytics.ts](https://github.com/expo/eas-cli/blob/v0.13.0/build/commands/analytics.ts)_
|
||||
|
||||
## `eas build`
|
||||
|
||||
@@ -120,6 +120,7 @@ USAGE
|
||||
|
||||
OPTIONS
|
||||
-p, --platform=(android|ios|all)
|
||||
--clear-cache Clear cache before the build
|
||||
--local Run build locally [experimental]
|
||||
--non-interactive Run command in --non-interactive mode
|
||||
--profile=profile [default: release] Name of the build profile from eas.json
|
||||
@@ -128,7 +129,7 @@ OPTIONS
|
||||
--[no-]wait Wait for build(s) to complete
|
||||
```
|
||||
|
||||
_See code: [build/commands/build/index.ts](https://github.com/expo/eas-cli/blob/v0.11.1/build/commands/build/index.ts)_
|
||||
_See code: [build/commands/build/index.ts](https://github.com/expo/eas-cli/blob/v0.13.0/build/commands/build/index.ts)_
|
||||
|
||||
## `eas build:cancel [BUILD_ID]`
|
||||
|
||||
@@ -139,7 +140,7 @@ USAGE
|
||||
$ eas build:cancel [BUILD_ID]
|
||||
```
|
||||
|
||||
_See code: [build/commands/build/cancel.ts](https://github.com/expo/eas-cli/blob/v0.11.1/build/commands/build/cancel.ts)_
|
||||
_See code: [build/commands/build/cancel.ts](https://github.com/expo/eas-cli/blob/v0.13.0/build/commands/build/cancel.ts)_
|
||||
|
||||
## `eas build:configure`
|
||||
|
||||
@@ -154,7 +155,7 @@ OPTIONS
|
||||
--allow-experimental Enable experimental configuration steps.
|
||||
```
|
||||
|
||||
_See code: [build/commands/build/configure.ts](https://github.com/expo/eas-cli/blob/v0.11.1/build/commands/build/configure.ts)_
|
||||
_See code: [build/commands/build/configure.ts](https://github.com/expo/eas-cli/blob/v0.13.0/build/commands/build/configure.ts)_
|
||||
|
||||
## `eas build:list`
|
||||
|
||||
@@ -170,7 +171,7 @@ OPTIONS
|
||||
--status=(in-queue|in-progress|errored|finished|canceled)
|
||||
```
|
||||
|
||||
_See code: [build/commands/build/list.ts](https://github.com/expo/eas-cli/blob/v0.11.1/build/commands/build/list.ts)_
|
||||
_See code: [build/commands/build/list.ts](https://github.com/expo/eas-cli/blob/v0.13.0/build/commands/build/list.ts)_
|
||||
|
||||
## `eas build:view [BUILD_ID]`
|
||||
|
||||
@@ -181,7 +182,7 @@ USAGE
|
||||
$ eas build:view [BUILD_ID]
|
||||
```
|
||||
|
||||
_See code: [build/commands/build/view.ts](https://github.com/expo/eas-cli/blob/v0.11.1/build/commands/build/view.ts)_
|
||||
_See code: [build/commands/build/view.ts](https://github.com/expo/eas-cli/blob/v0.13.0/build/commands/build/view.ts)_
|
||||
|
||||
## `eas credentials`
|
||||
|
||||
@@ -192,7 +193,7 @@ USAGE
|
||||
$ eas credentials
|
||||
```
|
||||
|
||||
_See code: [build/commands/credentials.ts](https://github.com/expo/eas-cli/blob/v0.11.1/build/commands/credentials.ts)_
|
||||
_See code: [build/commands/credentials.ts](https://github.com/expo/eas-cli/blob/v0.13.0/build/commands/credentials.ts)_
|
||||
|
||||
## `eas device:create`
|
||||
|
||||
@@ -203,7 +204,7 @@ USAGE
|
||||
$ eas device:create
|
||||
```
|
||||
|
||||
_See code: [build/commands/device/create.ts](https://github.com/expo/eas-cli/blob/v0.11.1/build/commands/device/create.ts)_
|
||||
_See code: [build/commands/device/create.ts](https://github.com/expo/eas-cli/blob/v0.13.0/build/commands/device/create.ts)_
|
||||
|
||||
## `eas device:list`
|
||||
|
||||
@@ -217,7 +218,7 @@ OPTIONS
|
||||
--apple-team-id=apple-team-id
|
||||
```
|
||||
|
||||
_See code: [build/commands/device/list.ts](https://github.com/expo/eas-cli/blob/v0.11.1/build/commands/device/list.ts)_
|
||||
_See code: [build/commands/device/list.ts](https://github.com/expo/eas-cli/blob/v0.13.0/build/commands/device/list.ts)_
|
||||
|
||||
## `eas device:view [UDID]`
|
||||
|
||||
@@ -228,7 +229,7 @@ USAGE
|
||||
$ eas device:view [UDID]
|
||||
```
|
||||
|
||||
_See code: [build/commands/device/view.ts](https://github.com/expo/eas-cli/blob/v0.11.1/build/commands/device/view.ts)_
|
||||
_See code: [build/commands/device/view.ts](https://github.com/expo/eas-cli/blob/v0.13.0/build/commands/device/view.ts)_
|
||||
|
||||
## `eas help [COMMAND]`
|
||||
|
||||
@@ -261,6 +262,8 @@ OPTIONS
|
||||
--value=value Value of the secret
|
||||
```
|
||||
|
||||
_See code: [build/commands/secret/create.ts](https://github.com/expo/eas-cli/blob/v0.13.0/build/commands/secret/create.ts)_
|
||||
|
||||
## `eas secret:delete`
|
||||
|
||||
Delete an environment secret by ID.
|
||||
@@ -276,6 +279,8 @@ DESCRIPTION
|
||||
Unsure where to find the secret's ID? Run eas secrets:list
|
||||
```
|
||||
|
||||
_See code: [build/commands/secret/delete.ts](https://github.com/expo/eas-cli/blob/v0.13.0/build/commands/secret/delete.ts)_
|
||||
|
||||
## `eas secret:list`
|
||||
|
||||
Lists environment secrets available for your current app
|
||||
@@ -285,6 +290,8 @@ USAGE
|
||||
$ eas secret:list
|
||||
```
|
||||
|
||||
_See code: [build/commands/secret/list.ts](https://github.com/expo/eas-cli/blob/v0.13.0/build/commands/secret/list.ts)_
|
||||
|
||||
## `eas submit --platform=(android|ios)`
|
||||
|
||||
Submits build artifact to app store
|
||||
@@ -362,7 +369,7 @@ EXAMPLES
|
||||
and provide its App ID
|
||||
```
|
||||
|
||||
_See code: [build/commands/submit.ts](https://github.com/expo/eas-cli/blob/v0.11.1/build/commands/submit.ts)_
|
||||
_See code: [build/commands/submit.ts](https://github.com/expo/eas-cli/blob/v0.13.0/build/commands/submit.ts)_
|
||||
|
||||
## `eas webhook:create`
|
||||
|
||||
@@ -381,7 +388,7 @@ OPTIONS
|
||||
--url=url Webhook URL
|
||||
```
|
||||
|
||||
_See code: [build/commands/webhook/create.ts](https://github.com/expo/eas-cli/blob/v0.11.1/build/commands/webhook/create.ts)_
|
||||
_See code: [build/commands/webhook/create.ts](https://github.com/expo/eas-cli/blob/v0.13.0/build/commands/webhook/create.ts)_
|
||||
|
||||
## `eas webhook:delete [ID]`
|
||||
|
||||
@@ -395,7 +402,7 @@ ARGUMENTS
|
||||
ID ID of the webhook to delete
|
||||
```
|
||||
|
||||
_See code: [build/commands/webhook/delete.ts](https://github.com/expo/eas-cli/blob/v0.11.1/build/commands/webhook/delete.ts)_
|
||||
_See code: [build/commands/webhook/delete.ts](https://github.com/expo/eas-cli/blob/v0.13.0/build/commands/webhook/delete.ts)_
|
||||
|
||||
## `eas webhook:list`
|
||||
|
||||
@@ -409,7 +416,7 @@ OPTIONS
|
||||
--event=(BUILD) Event type that triggers the webhook
|
||||
```
|
||||
|
||||
_See code: [build/commands/webhook/list.ts](https://github.com/expo/eas-cli/blob/v0.11.1/build/commands/webhook/list.ts)_
|
||||
_See code: [build/commands/webhook/list.ts](https://github.com/expo/eas-cli/blob/v0.13.0/build/commands/webhook/list.ts)_
|
||||
|
||||
## `eas webhook:update`
|
||||
|
||||
@@ -429,7 +436,7 @@ OPTIONS
|
||||
--url=url Webhook URL
|
||||
```
|
||||
|
||||
_See code: [build/commands/webhook/update.ts](https://github.com/expo/eas-cli/blob/v0.11.1/build/commands/webhook/update.ts)_
|
||||
_See code: [build/commands/webhook/update.ts](https://github.com/expo/eas-cli/blob/v0.13.0/build/commands/webhook/update.ts)_
|
||||
|
||||
## `eas webhook:view ID`
|
||||
|
||||
@@ -443,5 +450,5 @@ ARGUMENTS
|
||||
ID ID of the webhook to view
|
||||
```
|
||||
|
||||
_See code: [build/commands/webhook/view.ts](https://github.com/expo/eas-cli/blob/v0.11.1/build/commands/webhook/view.ts)_
|
||||
_See code: [build/commands/webhook/view.ts](https://github.com/expo/eas-cli/blob/v0.13.0/build/commands/webhook/view.ts)_
|
||||
<!-- commandsstop -->
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "eas-cli",
|
||||
"description": "EAS command line tool",
|
||||
"version": "0.11.1",
|
||||
"version": "0.13.0",
|
||||
"author": "Expo <[email protected]>",
|
||||
"bin": {
|
||||
"eas": "./bin/run"
|
||||
@@ -13,8 +13,8 @@
|
||||
"@expo/apple-utils": "0.0.0-alpha.18",
|
||||
"@expo/config": "~3.3.19",
|
||||
"@expo/config-plugins": "1.0.24",
|
||||
"@expo/eas-build-job": "0.2.22",
|
||||
"@expo/eas-json": "^0.11.0",
|
||||
"@expo/eas-build-job": "0.2.28",
|
||||
"@expo/eas-json": "^0.13.0",
|
||||
"@expo/json-file": "^8.2.24",
|
||||
"@expo/plist": "^0.0.11",
|
||||
"@expo/plugin-warn-if-update-available": "^1.7.0",
|
||||
|
||||
@@ -4,7 +4,8 @@ import path from 'path';
|
||||
|
||||
import { AndroidCredentials } from '../../credentials/android/AndroidCredentialsProvider';
|
||||
import { readEnvironmentSecretsAsync } from '../../credentials/credentialsJson/read';
|
||||
import { getProjectAccountNameAsync } from '../../project/projectUtils';
|
||||
import { getUsername } from '../../project/projectUtils';
|
||||
import { ensureLoggedInAsync } from '../../user/actions';
|
||||
import { gitRootDirectoryAsync } from '../../utils/git';
|
||||
import { BuildContext } from '../context';
|
||||
import { Platform } from '../types';
|
||||
@@ -71,7 +72,10 @@ async function prepareJobCommonAsync(
|
||||
ndk: ctx.buildProfile.ndk,
|
||||
env: ctx.buildProfile.env,
|
||||
},
|
||||
cache: ctx.buildProfile.cache,
|
||||
cache: {
|
||||
...ctx.buildProfile.cache,
|
||||
clear: ctx.commandCtx.clearCache,
|
||||
},
|
||||
secrets: {
|
||||
...(environmentSecrets ? { environmentSecrets } : {}),
|
||||
...buildCredentials,
|
||||
@@ -103,11 +107,11 @@ async function prepareManagedJobAsync(
|
||||
): Promise<Partial<Android.ManagedJob>> {
|
||||
const projectRootDirectory =
|
||||
path.relative(await gitRootDirectoryAsync(), ctx.commandCtx.projectDir) || '.';
|
||||
const accountName = await getProjectAccountNameAsync(ctx.commandCtx.exp);
|
||||
const username = getUsername(ctx.commandCtx.exp, await ensureLoggedInAsync());
|
||||
return {
|
||||
...(await prepareJobCommonAsync(ctx, jobData)),
|
||||
type: Workflow.MANAGED,
|
||||
username: accountName,
|
||||
username,
|
||||
buildType: buildProfile.buildType,
|
||||
releaseChannel: buildProfile.releaseChannel,
|
||||
projectRootDirectory,
|
||||
|
||||
@@ -109,10 +109,14 @@ export async function prepareBuildRequestForPlatformAsync<
|
||||
return undefined;
|
||||
} else {
|
||||
try {
|
||||
return sendBuildRequestAsync(builder, job, metadata);
|
||||
return await sendBuildRequestAsync(builder, job, metadata);
|
||||
} catch (error) {
|
||||
if (error?.expoApiV2ErrorCode === 'TURTLE_DEPRECATED_JOB_FORMAT') {
|
||||
Log.error('EAS Build API has changed, please upgrade to the latest eas-cli');
|
||||
if (error?.graphQLErrors?.[0]?.extensions?.errorCode === 'TURTLE_DEPRECATED_JOB_FORMAT') {
|
||||
Log.error('EAS Build API has changed, please upgrade to the latest eas-cli version.');
|
||||
} else if (error?.graphQLErrors) {
|
||||
Log.error(
|
||||
'Build request failed. Make sure you are using the latest eas-cli version. If the problem persists, please report the issue.'
|
||||
);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ export interface CommandContext {
|
||||
exp: ExpoConfig;
|
||||
nonInteractive: boolean;
|
||||
local: boolean;
|
||||
clearCache: boolean;
|
||||
skipCredentialsCheck: boolean;
|
||||
skipProjectConfiguration: boolean;
|
||||
waitForBuildEnd: boolean;
|
||||
@@ -33,6 +34,7 @@ export async function createCommandContextAsync({
|
||||
projectId,
|
||||
nonInteractive = false,
|
||||
local,
|
||||
clearCache = false,
|
||||
skipCredentialsCheck = false,
|
||||
skipProjectConfiguration = false,
|
||||
waitForBuildEnd,
|
||||
@@ -44,6 +46,7 @@ export async function createCommandContextAsync({
|
||||
projectDir: string;
|
||||
nonInteractive: boolean;
|
||||
local: boolean;
|
||||
clearCache: boolean;
|
||||
skipCredentialsCheck: boolean;
|
||||
skipProjectConfiguration: boolean;
|
||||
waitForBuildEnd: boolean;
|
||||
@@ -63,6 +66,7 @@ export async function createCommandContextAsync({
|
||||
exp,
|
||||
nonInteractive,
|
||||
local,
|
||||
clearCache,
|
||||
skipCredentialsCheck,
|
||||
skipProjectConfiguration,
|
||||
waitForBuildEnd,
|
||||
|
||||
@@ -9,7 +9,8 @@ import {
|
||||
isCredentialsMap,
|
||||
readEnvironmentSecretsAsync,
|
||||
} from '../../credentials/credentialsJson/read';
|
||||
import { getProjectAccountNameAsync } from '../../project/projectUtils';
|
||||
import { getUsername } from '../../project/projectUtils';
|
||||
import { ensureLoggedInAsync } from '../../user/actions';
|
||||
import { gitRootDirectoryAsync } from '../../utils/git';
|
||||
import { BuildContext } from '../context';
|
||||
import { Platform } from '../types';
|
||||
@@ -90,7 +91,10 @@ async function prepareJobCommonAsync(
|
||||
fastlane: ctx.buildProfile.fastlane,
|
||||
env: ctx.buildProfile.env,
|
||||
},
|
||||
cache: ctx.buildProfile.cache,
|
||||
cache: {
|
||||
...ctx.buildProfile.cache,
|
||||
clear: ctx.commandCtx.clearCache,
|
||||
},
|
||||
secrets: {
|
||||
...(environmentSecrets ? { environmentSecrets } : {}),
|
||||
buildCredentials,
|
||||
@@ -140,7 +144,7 @@ async function prepareManagedJobAsync(
|
||||
): Promise<Partial<Ios.ManagedJob>> {
|
||||
const projectRootDirectory =
|
||||
path.relative(await gitRootDirectoryAsync(), ctx.commandCtx.projectDir) || '.';
|
||||
const accountName = await getProjectAccountNameAsync(ctx.commandCtx.exp);
|
||||
const username = getUsername(ctx.commandCtx.exp, await ensureLoggedInAsync());
|
||||
return {
|
||||
...(await prepareJobCommonAsync(ctx, {
|
||||
credentials: jobData.credentials,
|
||||
@@ -149,7 +153,7 @@ async function prepareManagedJobAsync(
|
||||
})),
|
||||
type: Workflow.MANAGED,
|
||||
buildType: buildProfile.buildType,
|
||||
username: accountName,
|
||||
username,
|
||||
releaseChannel: buildProfile.releaseChannel,
|
||||
projectRootDirectory,
|
||||
};
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { Metadata } from '@expo/eas-build-job';
|
||||
import { CredentialsSource } from '@expo/eas-json';
|
||||
|
||||
import { getAppIdentifierAsync } from '../project/projectUtils';
|
||||
import { getAppIdentifierAsync, getUsername } from '../project/projectUtils';
|
||||
import { ensureLoggedInAsync } from '../user/actions';
|
||||
import { gitCommitHashAsync } from '../utils/git';
|
||||
import { readReleaseChannelSafelyAsync as readAndroidReleaseChannelSafelyAsync } from './android/UpdatesModule';
|
||||
import { BuildContext } from './context';
|
||||
@@ -42,6 +43,7 @@ export async function collectMetadata<T extends Platform>(
|
||||
})) ?? undefined,
|
||||
buildProfile: ctx.commandCtx.profile,
|
||||
gitCommitHash: await gitCommitHashAsync(),
|
||||
username: getUsername(ctx.commandCtx.exp, await ensureLoggedInAsync()),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,10 @@ export default class Build extends Command {
|
||||
allowNo: true,
|
||||
description: 'Wait for build(s) to complete',
|
||||
}),
|
||||
'clear-cache': flags.boolean({
|
||||
default: false,
|
||||
description: 'Clear cache before the build',
|
||||
}),
|
||||
};
|
||||
|
||||
async run(): Promise<void> {
|
||||
@@ -111,6 +115,7 @@ export default class Build extends Command {
|
||||
projectDir,
|
||||
projectId,
|
||||
nonInteractive,
|
||||
clearCache: flags['clear-cache'],
|
||||
skipCredentialsCheck: flags['skip-credentials-check'],
|
||||
local: flags.local,
|
||||
skipProjectConfiguration: flags['skip-project-configuration'],
|
||||
|
||||
@@ -14,6 +14,7 @@ export function createCtxMock(mockOverride: Record<string, any> = {}): Context {
|
||||
newIos: getNewIosApiMockWithoutCredentials(),
|
||||
android: getAndroidApiMockWithoutCredentials(),
|
||||
appStore: getAppstoreMock(),
|
||||
bestEffortAppStoreAuthenticateAsync: jest.fn(),
|
||||
ensureAppleCtx: jest.fn(),
|
||||
ensureProjectContext: jest.fn(),
|
||||
user: {
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
import { Platform } from '@expo/eas-build-job';
|
||||
import { CredentialsSource, IosDistributionType, IosEnterpriseProvisioning } from '@expo/eas-json';
|
||||
|
||||
import { IosAppBuildCredentialsFragment } from '../../graphql/generated';
|
||||
import Log from '../../log';
|
||||
import { CredentialsManager } from '../CredentialsManager';
|
||||
import { Context } from '../context';
|
||||
import * as credentialsJsonReader from '../credentialsJson/read';
|
||||
import type { IosCredentials } from '../credentialsJson/read';
|
||||
import { SetupBuildCredentials } from './actions/SetupBuildCredentials';
|
||||
import {
|
||||
getBuildCredentialsAsync,
|
||||
resolveDistributionType,
|
||||
} from './actions/new/BuildCredentialsUtils';
|
||||
import { AppLookupParams } from './api/GraphqlClient';
|
||||
import { isAdHocProfile } from './utils/provisioningProfile';
|
||||
|
||||
@@ -32,11 +26,10 @@ export default class IosCredentialsProvider {
|
||||
public async getCredentialsAsync(
|
||||
src: CredentialsSource.LOCAL | CredentialsSource.REMOTE
|
||||
): Promise<IosCredentials> {
|
||||
switch (src) {
|
||||
case CredentialsSource.LOCAL:
|
||||
return await this.getLocalAsync();
|
||||
case CredentialsSource.REMOTE:
|
||||
return await this.getRemoteAsync();
|
||||
if (src === CredentialsSource.LOCAL) {
|
||||
return await this.getLocalAsync();
|
||||
} else {
|
||||
return await this.getRemoteAsync();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,54 +63,18 @@ export default class IosCredentialsProvider {
|
||||
}
|
||||
|
||||
private async getRemoteAsync(): Promise<IosCredentials> {
|
||||
if (this.options.skipCredentialsCheck) {
|
||||
Log.log('Skipping credentials check');
|
||||
} else {
|
||||
await new CredentialsManager(this.ctx).runActionAsync(
|
||||
new SetupBuildCredentials({
|
||||
app: this.options.app,
|
||||
distribution: this.options.distribution,
|
||||
enterpriseProvisioning: this.options.enterpriseProvisioning,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
const buildCredentials = await this.fetchRemoteAsync();
|
||||
if (
|
||||
!buildCredentials?.distributionCertificate?.certificateP12 ||
|
||||
!buildCredentials.distributionCertificate?.certificatePassword
|
||||
) {
|
||||
if (this.options.skipCredentialsCheck) {
|
||||
throw new Error(
|
||||
'Distribution certificate is missing and credentials check was skipped. Run without --skip-credentials-check to set it up.'
|
||||
);
|
||||
} else {
|
||||
throw new Error('Distribution certificate is missing');
|
||||
}
|
||||
}
|
||||
if (!buildCredentials.provisioningProfile?.provisioningProfile) {
|
||||
if (this.options.skipCredentialsCheck) {
|
||||
throw new Error(
|
||||
'Provisioning profile is missing and credentials check was skipped. Run without --skip-credentials-check to set it up.'
|
||||
);
|
||||
} else {
|
||||
throw new Error('Provisioning profile is missing');
|
||||
}
|
||||
}
|
||||
const manager = new CredentialsManager(this.ctx);
|
||||
const { provisioningProfile, distributionCertificate } = await new SetupBuildCredentials({
|
||||
app: this.options.app,
|
||||
distribution: this.options.distribution,
|
||||
enterpriseProvisioning: this.options.enterpriseProvisioning,
|
||||
}).runAsync(manager, this.ctx);
|
||||
return {
|
||||
provisioningProfile: buildCredentials.provisioningProfile.provisioningProfile,
|
||||
provisioningProfile,
|
||||
distributionCertificate: {
|
||||
certP12: buildCredentials.distributionCertificate.certificateP12,
|
||||
certPassword: buildCredentials.distributionCertificate.certificatePassword,
|
||||
certP12: distributionCertificate.certificateP12,
|
||||
certPassword: distributionCertificate.certificatePassword,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
private async fetchRemoteAsync(): Promise<IosAppBuildCredentialsFragment | null> {
|
||||
const distributionType = resolveDistributionType(
|
||||
this.options.distribution,
|
||||
this.options.enterpriseProvisioning
|
||||
);
|
||||
return await getBuildCredentialsAsync(this.ctx, this.options.app, distributionType);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import { CredentialsSource } from '@expo/eas-json';
|
||||
import { vol } from 'memfs';
|
||||
|
||||
import { IosAppBuildCredentialsFragment } from '../../../graphql/generated';
|
||||
import { getAppstoreMock } from '../../__tests__/fixtures-appstore';
|
||||
import { createCtxMock } from '../../__tests__/fixtures-context';
|
||||
import { testIosAppCredentialsWithBuildCredentialsQueryResult } from '../../__tests__/fixtures-ios';
|
||||
@@ -9,13 +10,32 @@ import IosCredentialsProvider from '../IosCredentialsProvider';
|
||||
import { getAppLookupParamsFromContext } from '../actions/new/BuildCredentialsUtils';
|
||||
|
||||
jest.mock('fs');
|
||||
jest.mock('../validators/validateProvisioningProfile', () => ({
|
||||
validateProvisioningProfileAsync: async (
|
||||
_ctx: any,
|
||||
_app: any,
|
||||
buildCredentials: Partial<IosAppBuildCredentialsFragment> | null
|
||||
): Promise<boolean> => {
|
||||
return !!(
|
||||
buildCredentials &&
|
||||
buildCredentials.distributionCertificate &&
|
||||
buildCredentials.provisioningProfile
|
||||
);
|
||||
},
|
||||
}));
|
||||
|
||||
const originalConsoleLog = console.log;
|
||||
const originalConsoleError = console.error;
|
||||
const originalConsoleWarn = console.warn;
|
||||
beforeAll(() => {
|
||||
console.log = jest.fn();
|
||||
console.error = jest.fn();
|
||||
console.warn = jest.fn();
|
||||
});
|
||||
afterAll(() => {
|
||||
console.log = originalConsoleLog;
|
||||
console.error = originalConsoleError;
|
||||
console.warn = originalConsoleWarn;
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -27,7 +47,7 @@ describe(IosCredentialsProvider, () => {
|
||||
describe('remote credentials', () => {
|
||||
it('throws an error is credentials do not exist', async () => {
|
||||
const ctx = createCtxMock({
|
||||
nonInteractive: false,
|
||||
nonInteractive: true,
|
||||
appStore: getAppstoreMock(),
|
||||
projectDir: '/app',
|
||||
newIos: {
|
||||
@@ -46,15 +66,16 @@ describe(IosCredentialsProvider, () => {
|
||||
projectName: appLookupParams.projectName,
|
||||
},
|
||||
distribution: 'store',
|
||||
skipCredentialsCheck: true,
|
||||
});
|
||||
|
||||
await expect(provider.getCredentialsAsync(CredentialsSource.REMOTE)).rejects.toThrowError();
|
||||
await expect(provider.getCredentialsAsync(CredentialsSource.REMOTE)).rejects.toThrowError(
|
||||
/Credentials are not set up/
|
||||
);
|
||||
});
|
||||
|
||||
it('returns credentials if they exist', async () => {
|
||||
const ctx = createCtxMock({
|
||||
nonInteractive: false,
|
||||
nonInteractive: true,
|
||||
appStore: getAppstoreMock(),
|
||||
projectDir: '/app',
|
||||
newIos: {
|
||||
@@ -62,6 +83,11 @@ describe(IosCredentialsProvider, () => {
|
||||
getIosAppCredentialsWithBuildCredentialsAsync: jest.fn(
|
||||
() => testIosAppCredentialsWithBuildCredentialsQueryResult
|
||||
),
|
||||
getDistributionCertificateForAppAsync: jest.fn(
|
||||
() =>
|
||||
testIosAppCredentialsWithBuildCredentialsQueryResult.iosAppBuildCredentialsArray[0]
|
||||
.distributionCertificate
|
||||
),
|
||||
},
|
||||
});
|
||||
const appLookupParams = getAppLookupParamsFromContext(ctx);
|
||||
@@ -75,7 +101,6 @@ describe(IosCredentialsProvider, () => {
|
||||
projectName: appLookupParams.projectName,
|
||||
},
|
||||
distribution: 'store',
|
||||
skipCredentialsCheck: true,
|
||||
});
|
||||
|
||||
const buildCredentials =
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { IosDistributionType, IosEnterpriseProvisioning } from '@expo/eas-json';
|
||||
import chalk from 'chalk';
|
||||
import nullthrows from 'nullthrows';
|
||||
|
||||
import {
|
||||
IosDistributionType as GraphQLIosDistributionType,
|
||||
@@ -26,10 +27,19 @@ interface Options {
|
||||
skipCredentialsCheck?: boolean;
|
||||
}
|
||||
|
||||
export class SetupBuildCredentials implements Action {
|
||||
interface IosAppBuildCredentials {
|
||||
iosDistributionType: GraphQLIosDistributionType;
|
||||
provisioningProfile: string;
|
||||
distributionCertificate: {
|
||||
certificateP12: string;
|
||||
certificatePassword: string;
|
||||
};
|
||||
}
|
||||
|
||||
export class SetupBuildCredentials implements Action<IosAppBuildCredentials> {
|
||||
constructor(private options: Options) {}
|
||||
|
||||
async runAsync(manager: CredentialsManager, ctx: Context): Promise<void> {
|
||||
async runAsync(manager: CredentialsManager, ctx: Context): Promise<IosAppBuildCredentials> {
|
||||
const { app } = this.options;
|
||||
|
||||
await ctx.bestEffortAppStoreAuthenticateAsync();
|
||||
@@ -46,12 +56,21 @@ export class SetupBuildCredentials implements Action {
|
||||
}
|
||||
try {
|
||||
const buildCredentials = await this.setupBuildCredentials(ctx);
|
||||
|
||||
const appInfo = `@${app.account.name}/${app.projectName} (${app.bundleIdentifier})`;
|
||||
displayProjectCredentials(app, buildCredentials);
|
||||
Log.newLine();
|
||||
Log.log(chalk.green(`All credentials are ready to build ${appInfo}`));
|
||||
Log.newLine();
|
||||
return {
|
||||
iosDistributionType: buildCredentials.iosDistributionType,
|
||||
provisioningProfile: nullthrows(buildCredentials.provisioningProfile?.provisioningProfile),
|
||||
distributionCertificate: {
|
||||
certificateP12: nullthrows(buildCredentials.distributionCertificate?.certificateP12),
|
||||
certificatePassword: nullthrows(
|
||||
buildCredentials.distributionCertificate?.certificatePassword
|
||||
),
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
Log.error('Failed to setup credentials.');
|
||||
throw error;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { IosDistributionType, IosEnterpriseProvisioning } from '@expo/eas-json';
|
||||
import nullthrows from 'nullthrows';
|
||||
|
||||
import {
|
||||
@@ -17,6 +16,17 @@ import { Context } from '../../../context';
|
||||
import { AppLookupParams } from '../../api/GraphqlClient';
|
||||
import { resolveAppleTeamIfAuthenticatedAsync } from './AppleTeamUtils';
|
||||
|
||||
export async function getAllBuildCredentialsAsync(
|
||||
ctx: Context,
|
||||
app: AppLookupParams
|
||||
): Promise<IosAppBuildCredentialsFragment[]> {
|
||||
const appCredentials = await ctx.newIos.getIosAppCredentialsWithBuildCredentialsAsync(app, {});
|
||||
if (!appCredentials) {
|
||||
return [];
|
||||
}
|
||||
return appCredentials.iosAppBuildCredentialsArray;
|
||||
}
|
||||
|
||||
export async function getBuildCredentialsAsync(
|
||||
ctx: Context,
|
||||
app: AppLookupParams,
|
||||
@@ -94,20 +104,3 @@ export function getAppLookupParamsFromContext(ctx: Context): AppLookupParams {
|
||||
|
||||
return { account, projectName, bundleIdentifier };
|
||||
}
|
||||
|
||||
export function resolveDistributionType(
|
||||
distribution: IosDistributionType,
|
||||
enterpriseProvisioning?: IosEnterpriseProvisioning
|
||||
): GraphQLIosDistributionType {
|
||||
if (distribution === 'internal') {
|
||||
if (enterpriseProvisioning === 'adhoc') {
|
||||
return GraphQLIosDistributionType.AdHoc;
|
||||
} else if (enterpriseProvisioning === 'universal') {
|
||||
return GraphQLIosDistributionType.Enterprise;
|
||||
} else {
|
||||
return GraphQLIosDistributionType.AdHoc;
|
||||
}
|
||||
} else {
|
||||
return GraphQLIosDistributionType.AppStore;
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@ export class SetupAdhocProvisioningProfile {
|
||||
);
|
||||
if (areBuildCredentialsSetup) {
|
||||
const buildCredentials = nullthrows(currentBuildCredentials);
|
||||
if (await this.shouldGenerateNewProfileAsync(ctx, buildCredentials)) {
|
||||
if (await this.shouldUseExistingProfileAsync(ctx, buildCredentials)) {
|
||||
return buildCredentials;
|
||||
}
|
||||
}
|
||||
@@ -150,7 +150,7 @@ export class SetupAdhocProvisioningProfile {
|
||||
return await validateProvisioningProfileAsync(ctx, this.app, buildCredentials);
|
||||
}
|
||||
|
||||
private async shouldGenerateNewProfileAsync(
|
||||
private async shouldUseExistingProfileAsync(
|
||||
ctx: Context,
|
||||
buildCredentials: IosAppBuildCredentialsFragment
|
||||
): Promise<boolean> {
|
||||
|
||||
@@ -80,6 +80,22 @@ export class SetupDistributionCertificate {
|
||||
if (!currentCertificate) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const now = new Date();
|
||||
if (
|
||||
now < new Date(currentCertificate.validityNotBefore) ||
|
||||
now > new Date(currentCertificate.validityNotAfter)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ctx.appStore.authCtx) {
|
||||
Log.warn(
|
||||
"Skipping Distribution Certificate validation on Apple Servers because we aren't authenticated."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
const validCertSerialNumbers = (await this.getValidDistCertsAsync(ctx)).map(
|
||||
i => i.serialNumber
|
||||
);
|
||||
|
||||
+104
-1
@@ -1,12 +1,115 @@
|
||||
import { IosAppBuildCredentialsFragment } from '../../../../graphql/generated';
|
||||
import { IosAppBuildCredentialsFragment, IosDistributionType } from '../../../../graphql/generated';
|
||||
import Log from '../../../../log';
|
||||
import { promptAsync } from '../../../../prompts';
|
||||
import { Context } from '../../../context';
|
||||
import { AppLookupParams } from '../../api/GraphqlClient';
|
||||
import { getAllBuildCredentialsAsync } from './BuildCredentialsUtils';
|
||||
import { SetupAdhocProvisioningProfile } from './SetupAdhocProvisioningProfile';
|
||||
import { SetupProvisioningProfile } from './SetupProvisioningProfile';
|
||||
|
||||
/**
|
||||
* It's used when setting up credentials for internal distribution but `enterpriseProvisioning` is not set.
|
||||
*
|
||||
* TLDR: If the user authenticates with an account with Apple Developer Enterprise Program membership we ask them
|
||||
* to choose if they want to set up an adhoc or universal distribution provisioning profile. Otherwise, always
|
||||
* set up an adhoc provisioning profile.
|
||||
*/
|
||||
export class SetupInternalProvisioningProfile {
|
||||
constructor(private app: AppLookupParams) {}
|
||||
|
||||
async runAsync(ctx: Context): Promise<IosAppBuildCredentialsFragment> {
|
||||
const buildCredentials = await getAllBuildCredentialsAsync(ctx, this.app);
|
||||
|
||||
const adhocBuildCredentialsExist =
|
||||
buildCredentials.filter(
|
||||
({ iosDistributionType }) => iosDistributionType === IosDistributionType.AdHoc
|
||||
).length > 0;
|
||||
const enterpriseBuildCredentialsExist =
|
||||
buildCredentials.filter(
|
||||
({ iosDistributionType }) => iosDistributionType === IosDistributionType.Enterprise
|
||||
).length > 0;
|
||||
|
||||
if (!ctx.nonInteractive) {
|
||||
if (ctx.appStore.authCtx) {
|
||||
if (ctx.appStore.authCtx.team.inHouse) {
|
||||
return await this.askForDistributionTypeAndSetupAsync(
|
||||
ctx,
|
||||
'Which credentials would you like to set up?'
|
||||
);
|
||||
} else {
|
||||
return await this.setupAdhocProvisioningProfileAsync(ctx);
|
||||
}
|
||||
} else {
|
||||
if (adhocBuildCredentialsExist && enterpriseBuildCredentialsExist) {
|
||||
Log.log('You have set up both adhoc and universal distribution credentials.');
|
||||
return await this.askForDistributionTypeAndSetupAsync(
|
||||
ctx,
|
||||
'Which credentials would you like to use?'
|
||||
);
|
||||
} else if (adhocBuildCredentialsExist) {
|
||||
return await this.setupAdhocProvisioningProfileAsync(ctx);
|
||||
} else if (enterpriseBuildCredentialsExist) {
|
||||
return await this.setupUniversalProvisioningProfileAsync(ctx);
|
||||
} else {
|
||||
const { team } = await ctx.appStore.ensureAuthenticatedAsync();
|
||||
if (team.inHouse) {
|
||||
return await this.askForDistributionTypeAndSetupAsync(
|
||||
ctx,
|
||||
'Which credentials would you like to set up?'
|
||||
);
|
||||
} else {
|
||||
return await this.setupAdhocProvisioningProfileAsync(ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (adhocBuildCredentialsExist && enterpriseBuildCredentialsExist) {
|
||||
throw new Error(
|
||||
`You're in non-interactive mode. You have set up both adhoc and universal distribution credentials. Please set the 'enterpriseProvisioning' property (to 'adhoc' or 'universal') in eas.json to choose the credentials to use.`
|
||||
);
|
||||
} else if (adhocBuildCredentialsExist) {
|
||||
return await this.setupAdhocProvisioningProfileAsync(ctx);
|
||||
} else if (enterpriseBuildCredentialsExist) {
|
||||
return await this.setupUniversalProvisioningProfileAsync(ctx);
|
||||
} else {
|
||||
throw new Error(
|
||||
`You're in non-interactive mode. EAS CLI couldn't find any credentials suitable for internal distribution. Please run again in interactive mode.`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async setupAdhocProvisioningProfileAsync(
|
||||
ctx: Context
|
||||
): Promise<IosAppBuildCredentialsFragment> {
|
||||
return await new SetupAdhocProvisioningProfile(this.app).runAsync(ctx);
|
||||
}
|
||||
|
||||
private async setupUniversalProvisioningProfileAsync(
|
||||
ctx: Context
|
||||
): Promise<IosAppBuildCredentialsFragment> {
|
||||
return await new SetupProvisioningProfile(this.app, IosDistributionType.Enterprise).runAsync(
|
||||
ctx
|
||||
);
|
||||
}
|
||||
|
||||
private async askForDistributionTypeAndSetupAsync(
|
||||
ctx: Context,
|
||||
message: string
|
||||
): Promise<IosAppBuildCredentialsFragment> {
|
||||
const { distributionType } = await promptAsync({
|
||||
type: 'select',
|
||||
name: 'distributionType',
|
||||
message,
|
||||
choices: [
|
||||
{ title: 'Universal Distribution', value: IosDistributionType.Enterprise },
|
||||
{ title: 'Adhoc Distribution', value: IosDistributionType.AdHoc },
|
||||
],
|
||||
});
|
||||
if (distributionType === IosDistributionType.Enterprise) {
|
||||
return await this.setupUniversalProvisioningProfileAsync(ctx);
|
||||
} else {
|
||||
return await this.setupAdhocProvisioningProfileAsync(ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
+314
@@ -0,0 +1,314 @@
|
||||
import { asMock } from '../../../../../__tests__/utils';
|
||||
import {
|
||||
IosAppBuildCredentialsFragment,
|
||||
IosDistributionType,
|
||||
} from '../../../../../graphql/generated';
|
||||
import { promptAsync } from '../../../../../prompts';
|
||||
import { getAppstoreMock, testAuthCtx } from '../../../../__tests__/fixtures-appstore';
|
||||
import { createCtxMock } from '../../../../__tests__/fixtures-context';
|
||||
import { getAllBuildCredentialsAsync } from '../BuildCredentialsUtils';
|
||||
import { SetupAdhocProvisioningProfile } from '../SetupAdhocProvisioningProfile';
|
||||
import { SetupInternalProvisioningProfile } from '../SetupInternalProvisioningProfile';
|
||||
import { SetupProvisioningProfile } from '../SetupProvisioningProfile';
|
||||
|
||||
jest.mock('../../../../../prompts');
|
||||
jest.mock('../SetupAdhocProvisioningProfile');
|
||||
jest.mock('../SetupProvisioningProfile');
|
||||
jest.mock('../BuildCredentialsUtils', () => ({ getAllBuildCredentialsAsync: jest.fn() }));
|
||||
|
||||
beforeEach(() => {
|
||||
asMock(promptAsync).mockReset();
|
||||
|
||||
asMock(getAllBuildCredentialsAsync).mockReset();
|
||||
asMock(getAllBuildCredentialsAsync).mockImplementation(() => {
|
||||
throw new Error(
|
||||
`unhandled getAllBuildCredentialsAsync call - this shouldn't happen - fix tests!`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
const testAdhocBuildCredentials: IosAppBuildCredentialsFragment = {
|
||||
id: 'test-app-build-credentials-id-1',
|
||||
iosDistributionType: IosDistributionType.AdHoc,
|
||||
};
|
||||
const testEnterpriseBuildCredentials: IosAppBuildCredentialsFragment = {
|
||||
id: 'test-app-build-credentials-id-2',
|
||||
iosDistributionType: IosDistributionType.Enterprise,
|
||||
};
|
||||
|
||||
describe(SetupInternalProvisioningProfile, () => {
|
||||
describe('interactive mode', () => {
|
||||
describe('when authenticated with apple', () => {
|
||||
it('runs the SetupAdhocProvisioningProfile action for non-enterprise team', async () => {
|
||||
asMock(getAllBuildCredentialsAsync).mockImplementationOnce(() => {
|
||||
const buildCredentials: IosAppBuildCredentialsFragment[] = [];
|
||||
return buildCredentials;
|
||||
});
|
||||
const action = new SetupInternalProvisioningProfile({
|
||||
account: { id: 'account-id', name: 'account-name' },
|
||||
bundleIdentifier: 'com.expo.test',
|
||||
projectName: 'testproject',
|
||||
});
|
||||
const ctx = createCtxMock({
|
||||
nonInteractive: false,
|
||||
appStore: {
|
||||
...getAppstoreMock(),
|
||||
ensureAuthenticatedAsync: jest.fn(() => testAuthCtx),
|
||||
authCtx: testAuthCtx,
|
||||
},
|
||||
});
|
||||
|
||||
const runAsync = jest.fn();
|
||||
SetupAdhocProvisioningProfile.prototype.runAsync = runAsync;
|
||||
|
||||
await action.runAsync(ctx);
|
||||
|
||||
expect(runAsync).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('asks the user for an action to run when they have access to an enterprise team', async () => {
|
||||
asMock(promptAsync).mockImplementationOnce(() => ({
|
||||
distributionType: IosDistributionType.Enterprise,
|
||||
}));
|
||||
asMock(getAllBuildCredentialsAsync).mockImplementationOnce(() => {
|
||||
const buildCredentials: IosAppBuildCredentialsFragment[] = [];
|
||||
return buildCredentials;
|
||||
});
|
||||
|
||||
const action = new SetupInternalProvisioningProfile({
|
||||
account: { id: 'account-id', name: 'account-name' },
|
||||
bundleIdentifier: 'com.expo.test',
|
||||
projectName: 'testproject',
|
||||
});
|
||||
const ctx = createCtxMock({
|
||||
nonInteractive: false,
|
||||
appStore: {
|
||||
...getAppstoreMock(),
|
||||
ensureAuthenticatedAsync: jest.fn(() => ({
|
||||
...testAuthCtx,
|
||||
team: { ...testAuthCtx.team, inHouse: true },
|
||||
})),
|
||||
authCtx: { ...testAuthCtx, team: { ...testAuthCtx.team, inHouse: true } },
|
||||
},
|
||||
});
|
||||
|
||||
const runAsync = jest.fn();
|
||||
SetupProvisioningProfile.prototype.runAsync = runAsync;
|
||||
|
||||
await action.runAsync(ctx);
|
||||
|
||||
expect(runAsync).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
describe('when not authenticated with apple', () => {
|
||||
it('asks the user for an action to run when both adhoc and universal distribution credentials exist', async () => {
|
||||
asMock(promptAsync).mockImplementationOnce(() => ({
|
||||
distributionType: IosDistributionType.Enterprise,
|
||||
}));
|
||||
asMock(getAllBuildCredentialsAsync).mockImplementationOnce(() => {
|
||||
const buildCredentials: IosAppBuildCredentialsFragment[] = [
|
||||
testAdhocBuildCredentials,
|
||||
testEnterpriseBuildCredentials,
|
||||
];
|
||||
return buildCredentials;
|
||||
});
|
||||
|
||||
const action = new SetupInternalProvisioningProfile({
|
||||
account: { id: 'account-id', name: 'account-name' },
|
||||
bundleIdentifier: 'com.expo.test',
|
||||
projectName: 'testproject',
|
||||
});
|
||||
const ctx = createCtxMock({
|
||||
nonInteractive: false,
|
||||
appStore: {
|
||||
...getAppstoreMock(),
|
||||
ensureAuthenticatedAsync: jest.fn(() => null),
|
||||
authCtx: null,
|
||||
},
|
||||
});
|
||||
|
||||
const runAsync = jest.fn();
|
||||
SetupProvisioningProfile.prototype.runAsync = runAsync;
|
||||
|
||||
await action.runAsync(ctx);
|
||||
|
||||
expect(runAsync).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('runs the SetupAdhocProvisioningProfile action when adhoc credentials exist', async () => {
|
||||
asMock(promptAsync).mockImplementationOnce(() => ({
|
||||
distributionType: IosDistributionType.Enterprise,
|
||||
}));
|
||||
asMock(getAllBuildCredentialsAsync).mockImplementationOnce(() => {
|
||||
const buildCredentials: IosAppBuildCredentialsFragment[] = [testAdhocBuildCredentials];
|
||||
return buildCredentials;
|
||||
});
|
||||
|
||||
const action = new SetupInternalProvisioningProfile({
|
||||
account: { id: 'account-id', name: 'account-name' },
|
||||
bundleIdentifier: 'com.expo.test',
|
||||
projectName: 'testproject',
|
||||
});
|
||||
const ctx = createCtxMock({
|
||||
nonInteractive: false,
|
||||
appStore: {
|
||||
...getAppstoreMock(),
|
||||
ensureAuthenticatedAsync: jest.fn(() => null),
|
||||
authCtx: null,
|
||||
},
|
||||
});
|
||||
|
||||
const runAsync = jest.fn();
|
||||
SetupAdhocProvisioningProfile.prototype.runAsync = runAsync;
|
||||
|
||||
await action.runAsync(ctx);
|
||||
|
||||
expect(runAsync).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('runs the SetupProvisioningProfile action when enterprise credentials exist', async () => {
|
||||
asMock(promptAsync).mockImplementationOnce(() => ({
|
||||
distributionType: IosDistributionType.Enterprise,
|
||||
}));
|
||||
asMock(getAllBuildCredentialsAsync).mockImplementationOnce(() => {
|
||||
const buildCredentials: IosAppBuildCredentialsFragment[] = [
|
||||
testEnterpriseBuildCredentials,
|
||||
];
|
||||
return buildCredentials;
|
||||
});
|
||||
|
||||
const action = new SetupInternalProvisioningProfile({
|
||||
account: { id: 'account-id', name: 'account-name' },
|
||||
bundleIdentifier: 'com.expo.test',
|
||||
projectName: 'testproject',
|
||||
});
|
||||
const ctx = createCtxMock({
|
||||
nonInteractive: false,
|
||||
appStore: {
|
||||
...getAppstoreMock(),
|
||||
ensureAuthenticatedAsync: jest.fn(() => null),
|
||||
authCtx: null,
|
||||
},
|
||||
});
|
||||
|
||||
const runAsync = jest.fn();
|
||||
SetupProvisioningProfile.prototype.runAsync = runAsync;
|
||||
|
||||
await action.runAsync(ctx);
|
||||
|
||||
expect(runAsync).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('forces the apple authentication when neither adhoc nor enterprise credentials exist', async () => {
|
||||
asMock(promptAsync).mockImplementationOnce(() => ({
|
||||
distributionType: IosDistributionType.Enterprise,
|
||||
}));
|
||||
asMock(getAllBuildCredentialsAsync).mockImplementationOnce(() => {
|
||||
const buildCredentials: IosAppBuildCredentialsFragment[] = [];
|
||||
return buildCredentials;
|
||||
});
|
||||
|
||||
const action = new SetupInternalProvisioningProfile({
|
||||
account: { id: 'account-id', name: 'account-name' },
|
||||
bundleIdentifier: 'com.expo.test',
|
||||
projectName: 'testproject',
|
||||
});
|
||||
const ctx = createCtxMock({
|
||||
nonInteractive: false,
|
||||
appStore: {
|
||||
...getAppstoreMock(),
|
||||
ensureAuthenticatedAsync: jest.fn(() => testAuthCtx),
|
||||
authCtx: null,
|
||||
},
|
||||
});
|
||||
|
||||
await action.runAsync(ctx);
|
||||
|
||||
expect(ctx.appStore.ensureAuthenticatedAsync).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('non-interactive mode', () => {
|
||||
it('throws an error when both adhoc and enterprise credentials are set up', async () => {
|
||||
asMock(getAllBuildCredentialsAsync).mockImplementationOnce(() => {
|
||||
const buildCredentials: IosAppBuildCredentialsFragment[] = [
|
||||
testAdhocBuildCredentials,
|
||||
testEnterpriseBuildCredentials,
|
||||
];
|
||||
return buildCredentials;
|
||||
});
|
||||
const action = new SetupInternalProvisioningProfile({
|
||||
account: { id: 'account-id', name: 'account-name' },
|
||||
bundleIdentifier: 'com.expo.test',
|
||||
projectName: 'testproject',
|
||||
});
|
||||
const ctx = createCtxMock({
|
||||
nonInteractive: true,
|
||||
});
|
||||
await expect(action.runAsync(ctx)).rejects.toThrow(
|
||||
/You have set up both adhoc and universal distribution credentials/
|
||||
);
|
||||
});
|
||||
|
||||
it('throws an error when neither adhoc nor enterprise credentials are set up', async () => {
|
||||
asMock(getAllBuildCredentialsAsync).mockImplementationOnce(() => {
|
||||
const buildCredentials: IosAppBuildCredentialsFragment[] = [];
|
||||
return buildCredentials;
|
||||
});
|
||||
const action = new SetupInternalProvisioningProfile({
|
||||
account: { id: 'account-id', name: 'account-name' },
|
||||
bundleIdentifier: 'com.expo.test',
|
||||
projectName: 'testproject',
|
||||
});
|
||||
const ctx = createCtxMock({
|
||||
nonInteractive: true,
|
||||
});
|
||||
await expect(action.runAsync(ctx)).rejects.toThrow(/couldn't find any credentials/);
|
||||
});
|
||||
|
||||
it('runs the SetupAdhocProvisioningProfile action when adhoc credentials exist', async () => {
|
||||
asMock(getAllBuildCredentialsAsync).mockImplementationOnce(() => {
|
||||
const buildCredentials: IosAppBuildCredentialsFragment[] = [testAdhocBuildCredentials];
|
||||
return buildCredentials;
|
||||
});
|
||||
const action = new SetupInternalProvisioningProfile({
|
||||
account: { id: 'account-id', name: 'account-name' },
|
||||
bundleIdentifier: 'com.expo.test',
|
||||
projectName: 'testproject',
|
||||
});
|
||||
const ctx = createCtxMock({
|
||||
nonInteractive: true,
|
||||
});
|
||||
|
||||
const runAsync = jest.fn();
|
||||
SetupAdhocProvisioningProfile.prototype.runAsync = runAsync;
|
||||
|
||||
await action.runAsync(ctx);
|
||||
|
||||
expect(runAsync).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('runs the SetupProvisioningProfile action when enterprise credentials exist', async () => {
|
||||
asMock(getAllBuildCredentialsAsync).mockImplementationOnce(() => {
|
||||
const buildCredentials: IosAppBuildCredentialsFragment[] = [testEnterpriseBuildCredentials];
|
||||
return buildCredentials;
|
||||
});
|
||||
const action = new SetupInternalProvisioningProfile({
|
||||
account: { id: 'account-id', name: 'account-name' },
|
||||
bundleIdentifier: 'com.expo.test',
|
||||
projectName: 'testproject',
|
||||
});
|
||||
const ctx = createCtxMock({
|
||||
nonInteractive: true,
|
||||
});
|
||||
|
||||
const runAsync = jest.fn();
|
||||
SetupProvisioningProfile.prototype.runAsync = runAsync;
|
||||
|
||||
await action.runAsync(ctx);
|
||||
|
||||
expect(runAsync).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -98,7 +98,7 @@ export async function createOrUpdateIosAppBuildCredentialsAsync(
|
||||
|
||||
export async function getIosAppCredentialsWithBuildCredentialsAsync(
|
||||
appLookupParams: AppLookupParams,
|
||||
{ iosDistributionType }: { iosDistributionType: IosDistributionType }
|
||||
{ iosDistributionType }: { iosDistributionType?: IosDistributionType }
|
||||
): Promise<IosAppCredentialsWithBuildCredentialsQueryResult | null> {
|
||||
const { account, bundleIdentifier } = appLookupParams;
|
||||
const appleAppIdentifier = await AppleAppIdentifierQuery.byBundleIdentifierAsync(
|
||||
|
||||
@@ -66,7 +66,7 @@ const IosAppCredentialsQuery = {
|
||||
iosDistributionType,
|
||||
}: {
|
||||
appleAppIdentifierId: string;
|
||||
iosDistributionType: IosDistributionType;
|
||||
iosDistributionType?: IosDistributionType;
|
||||
}
|
||||
): Promise<IosAppCredentialsWithBuildCredentialsQueryResult | null> {
|
||||
const data = await withErrorHandlingAsync(
|
||||
@@ -76,7 +76,7 @@ const IosAppCredentialsQuery = {
|
||||
query IosAppCredentialsWithBuildCredentialsByAppIdentifierIdQuery(
|
||||
$projectFullName: String!
|
||||
$appleAppIdentifierId: String!
|
||||
$iosDistributionType: IosDistributionType!
|
||||
$iosDistributionType: IosDistributionType
|
||||
) {
|
||||
app {
|
||||
byFullName(fullName: $projectFullName) {
|
||||
|
||||
@@ -92,7 +92,7 @@ export class ManageIos implements Action {
|
||||
});
|
||||
|
||||
try {
|
||||
await manager.runActionAsync(this.getAction(manager, ctx, accountName, action));
|
||||
await this.getAction(ctx, accountName, action).runAsync(manager, ctx);
|
||||
} catch (err) {
|
||||
Log.error(err);
|
||||
}
|
||||
@@ -115,12 +115,7 @@ export class ManageIos implements Action {
|
||||
return { accountName, projectName, bundleIdentifier };
|
||||
}
|
||||
|
||||
private getAction(
|
||||
manager: CredentialsManager,
|
||||
ctx: Context,
|
||||
accountName: string,
|
||||
action: ActionType
|
||||
): Action {
|
||||
private getAction(ctx: Context, accountName: string, action: ActionType): Action<unknown> {
|
||||
switch (action) {
|
||||
case ActionType.CreateDistributionCertificate:
|
||||
return new CreateDistributionCertificateStandaloneManager(accountName);
|
||||
|
||||
@@ -127,10 +127,11 @@ export class ManageIosBeta implements Action {
|
||||
if (!iosDistributionTypeEasConfig) {
|
||||
throw new Error(`The distributionType field is required in your iOS build profile`);
|
||||
}
|
||||
return await new SetupBuildCredentials({
|
||||
await new SetupBuildCredentials({
|
||||
app: appLookupParams,
|
||||
distribution: iosDistributionTypeEasConfig,
|
||||
}).runAsync(manager, ctx);
|
||||
return;
|
||||
}
|
||||
case ActionType.SetupBuildCredentialsFromCredentialsJson: {
|
||||
const iosAppCredentials = await ctx.newIos.getIosAppCredentialsWithCommonFieldsAsync(
|
||||
|
||||
@@ -19,7 +19,7 @@ Your app archive (.ipa) will be installable on your equipment as long as you sig
|
||||
The provisioning profile needs to contain the UDIDs (unique identifiers) of your iPhones and iPads.
|
||||
|
||||
First of all, please choose the Expo account under which you want to register your devices.
|
||||
Later, authenticate with Apple and choose your desired Apple Team (if you're Apple ID has access to multiple teams).`;
|
||||
Later, authenticate with Apple and choose your desired Apple Team (if your Apple ID has access to multiple teams).`;
|
||||
|
||||
export default class DeviceManager {
|
||||
constructor(private ctx: DeviceManagerContext) {}
|
||||
|
||||
@@ -4058,7 +4058,7 @@ export type IosAppCredentialsByAppIdentifierIdQuery = (
|
||||
export type IosAppCredentialsWithBuildCredentialsByAppIdentifierIdQueryVariables = Exact<{
|
||||
projectFullName: Scalars['String'];
|
||||
appleAppIdentifierId: Scalars['String'];
|
||||
iosDistributionType: IosDistributionType;
|
||||
iosDistributionType?: Maybe<IosDistributionType>;
|
||||
}>;
|
||||
|
||||
|
||||
|
||||
@@ -26,6 +26,22 @@ export function getProjectAccountName(exp: ExpoConfig, user: Actor): string {
|
||||
}
|
||||
}
|
||||
|
||||
export function getUsername(exp: ExpoConfig, user: Actor): string | undefined {
|
||||
switch (user.__typename) {
|
||||
case 'User':
|
||||
return user.username;
|
||||
case 'Robot':
|
||||
// owner field is necessary to run `expo prebuild`
|
||||
if (!exp.owner) {
|
||||
throw new Error(
|
||||
'The "owner" manifest property is required when using robot users. See: https://docs.expo.io/versions/latest/config/app/#owner'
|
||||
);
|
||||
}
|
||||
// robot users don't have usernames
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
export async function getProjectAccountNameAsync(exp: ExpoConfig): Promise<string> {
|
||||
const user = await ensureLoggedInAsync();
|
||||
return getProjectAccountName(exp, user);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "@expo/eas-json",
|
||||
"description": "A library for interacting with the eas.json",
|
||||
"version": "0.11.0",
|
||||
"version": "0.13.0",
|
||||
"author": "Expo <[email protected]>",
|
||||
"bugs": "https://github.com/expo/eas-cli/issues",
|
||||
"dependencies": {
|
||||
"@expo/eas-build-job": "0.2.22",
|
||||
"@expo/eas-build-job": "0.2.28",
|
||||
"@hapi/joi": "^17.1.1",
|
||||
"fs-extra": "^9.0.1",
|
||||
"tslib": "^1"
|
||||
|
||||
@@ -1183,10 +1183,10 @@
|
||||
xcode "^3.0.0"
|
||||
xml-js "^1.6.11"
|
||||
|
||||
"@expo/[email protected]2":
|
||||
version "0.2.22"
|
||||
resolved "https://registry.yarnpkg.com/@expo/eas-build-job/-/eas-build-job-0.2.22.tgz#8432a8da25e8b8860ff7fec756821c660bcaef13"
|
||||
integrity sha512-a+922tmi9xxA3WclDhvnz8sascqjSO8wX78MOqgLVDW2iyZaT7C7MvUv6Z8Vig3zdKoUsQaTg8QWJyQl1biU8A==
|
||||
"@expo/[email protected]8":
|
||||
version "0.2.28"
|
||||
resolved "https://registry.yarnpkg.com/@expo/eas-build-job/-/eas-build-job-0.2.28.tgz#5ec6fb82be38525e183f23891b947fb0cf243999"
|
||||
integrity sha512-SqJvtTBiO9YgIo33oOudVkVhCYHBMmKrkIc1mZor6KuqVqNGz8kju25Qz3ldbw94OoS/7RPETn5TMM30c+NtCQ==
|
||||
dependencies:
|
||||
"@hapi/joi" "^17.1.1"
|
||||
|
||||
|
||||
Reference in new issue
Block a user