mirror of
https://github.com/expo/eas-cli.git
synced 2026-11-15 17:31:46 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
05b8eef622 | ||
|
|
50e56b5bc4 | ||
|
|
30ab4e62ec | ||
|
|
a1d901294b | ||
|
|
eed818cfe5 | ||
|
|
db0b6bfcf5 | ||
|
|
da81c1c6df | ||
|
|
42d3296f07 |
No files matched your search
+17
-1
@@ -6,6 +6,23 @@ This is the log of notable changes to EAS CLI and related packages.
|
||||
|
||||
### 🛠 Breaking changes
|
||||
|
||||
- `"credentialsSource": "auto"` is now deprecated. The option will use `"remote"` as the default value. ([#345](https://github.com/expo/eas-cli/pull/345) by [@dsokal](https://github.com/dsokal))
|
||||
|
||||
### 🎉 New features
|
||||
|
||||
- Add validation when setting up ad-hoc provisioning profile in non-interactive mode. ([#338](https://github.com/expo/eas-cli/pull/338) by [@dsokal](https://github.com/dsokal))
|
||||
- Allow for registering devices when running an ad-hoc build for the first time. ([#340](https://github.com/expo/eas-cli/pull/340) by [@dsokal](https://github.com/dsokal))
|
||||
|
||||
### 🐛 Bug fixes
|
||||
|
||||
- Fix the bug where all Android managed builds produced AAB archives. The `buildType` property from `eas.json` is not ignored now. ([#349](https://github.com/expo/eas-cli/pull/349) by [@dsokal](https://github.com/dsokal))
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
## [0.10.0](https://github.com/expo/eas-cli/releases/tag/v0.10.0) - 2021-04-16
|
||||
|
||||
### 🛠 Breaking changes
|
||||
|
||||
- `secrets:<COMMAND>` is renamed to `secret:<COMMAND>` ([#315](https://github.com/expo/eas-cli/pull/315) by [@fiberjw](https://github.com/fiberjw))
|
||||
- `secret:delete` now accepts `id` through a flag rather than an argument ([#315](https://github.com/expo/eas-cli/pull/315) by [@fiberjw](https://github.com/fiberjw))
|
||||
|
||||
@@ -44,7 +61,6 @@ This is the log of notable changes to EAS CLI and related packages.
|
||||
|
||||
- Fix the issue where the first iOS build fails for a project without `ios.bundleIdentifier` set in `app.json`. ([#319](https://github.com/expo/eas-cli/pull/319) by [@dsokal](https://github.com/dsokal))
|
||||
- Bump @expo/config-plugins to fix `eas build:configure` on Windows. ([d0f3e](https://github.com/expo/eas-cli/commit/d0f3e387e7f31dbce4c3b93b8d083c7d20d9e30d) by [@brentvatne](https://github.com/brentvatne))
|
||||
|
||||
- Replace REST API calls with GraphQL counterparts. ([#333](https://github.com/expo/eas-cli/pull/333) by [@barthap](https://github.com/barthap))
|
||||
|
||||
## [0.8.1](https://github.com/expo/eas-cli/releases/tag/v0.8.1) - 2021-04-06
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true,
|
||||
"version": "0.10.0"
|
||||
"version": "0.11.0"
|
||||
}
|
||||
+25
-25
@@ -49,7 +49,7 @@ eas --help COMMAND
|
||||
* [`eas help [COMMAND]`](#eas-help-command)
|
||||
* [`eas secret:create`](#eas-secretcreate)
|
||||
* [`eas secret:delete`](#eas-secretdelete)
|
||||
* [`eas secrets:list`](#eas-secretslist)
|
||||
* [`eas secret:list`](#eas-secretlist)
|
||||
* [`eas submit --platform=(android|ios)`](#eas-submit---platformandroidios)
|
||||
* [`eas webhook:create`](#eas-webhookcreate)
|
||||
* [`eas webhook:delete [ID]`](#eas-webhookdelete-id)
|
||||
@@ -69,7 +69,7 @@ ALIASES
|
||||
$ eas login
|
||||
```
|
||||
|
||||
_See code: [build/commands/account/login.ts](https://github.com/expo/eas-cli/blob/v0.10.0/build/commands/account/login.ts)_
|
||||
_See code: [build/commands/account/login.ts](https://github.com/expo/eas-cli/blob/v0.11.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.10.0/build/commands/account/logout.ts)_
|
||||
_See code: [build/commands/account/logout.ts](https://github.com/expo/eas-cli/blob/v0.11.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.10.0/build/commands/account/view.ts)_
|
||||
_See code: [build/commands/account/view.ts](https://github.com/expo/eas-cli/blob/v0.11.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.10.0/build/commands/analytics.ts)_
|
||||
_See code: [build/commands/analytics.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/analytics.ts)_
|
||||
|
||||
## `eas build`
|
||||
|
||||
@@ -128,7 +128,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.10.0/build/commands/build/index.ts)_
|
||||
_See code: [build/commands/build/index.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/build/index.ts)_
|
||||
|
||||
## `eas build:cancel [BUILD_ID]`
|
||||
|
||||
@@ -139,7 +139,7 @@ USAGE
|
||||
$ eas build:cancel [BUILD_ID]
|
||||
```
|
||||
|
||||
_See code: [build/commands/build/cancel.ts](https://github.com/expo/eas-cli/blob/v0.10.0/build/commands/build/cancel.ts)_
|
||||
_See code: [build/commands/build/cancel.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/build/cancel.ts)_
|
||||
|
||||
## `eas build:configure`
|
||||
|
||||
@@ -154,7 +154,7 @@ OPTIONS
|
||||
--allow-experimental Enable experimental configuration steps.
|
||||
```
|
||||
|
||||
_See code: [build/commands/build/configure.ts](https://github.com/expo/eas-cli/blob/v0.10.0/build/commands/build/configure.ts)_
|
||||
_See code: [build/commands/build/configure.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/build/configure.ts)_
|
||||
|
||||
## `eas build:list`
|
||||
|
||||
@@ -170,7 +170,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.10.0/build/commands/build/list.ts)_
|
||||
_See code: [build/commands/build/list.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/build/list.ts)_
|
||||
|
||||
## `eas build:view [BUILD_ID]`
|
||||
|
||||
@@ -181,7 +181,7 @@ USAGE
|
||||
$ eas build:view [BUILD_ID]
|
||||
```
|
||||
|
||||
_See code: [build/commands/build/view.ts](https://github.com/expo/eas-cli/blob/v0.10.0/build/commands/build/view.ts)_
|
||||
_See code: [build/commands/build/view.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/build/view.ts)_
|
||||
|
||||
## `eas credentials`
|
||||
|
||||
@@ -192,7 +192,7 @@ USAGE
|
||||
$ eas credentials
|
||||
```
|
||||
|
||||
_See code: [build/commands/credentials.ts](https://github.com/expo/eas-cli/blob/v0.10.0/build/commands/credentials.ts)_
|
||||
_See code: [build/commands/credentials.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/credentials.ts)_
|
||||
|
||||
## `eas device:create`
|
||||
|
||||
@@ -203,7 +203,7 @@ USAGE
|
||||
$ eas device:create
|
||||
```
|
||||
|
||||
_See code: [build/commands/device/create.ts](https://github.com/expo/eas-cli/blob/v0.10.0/build/commands/device/create.ts)_
|
||||
_See code: [build/commands/device/create.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/device/create.ts)_
|
||||
|
||||
## `eas device:list`
|
||||
|
||||
@@ -217,7 +217,7 @@ OPTIONS
|
||||
--apple-team-id=apple-team-id
|
||||
```
|
||||
|
||||
_See code: [build/commands/device/list.ts](https://github.com/expo/eas-cli/blob/v0.10.0/build/commands/device/list.ts)_
|
||||
_See code: [build/commands/device/list.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/device/list.ts)_
|
||||
|
||||
## `eas device:view [UDID]`
|
||||
|
||||
@@ -228,7 +228,7 @@ USAGE
|
||||
$ eas device:view [UDID]
|
||||
```
|
||||
|
||||
_See code: [build/commands/device/view.ts](https://github.com/expo/eas-cli/blob/v0.10.0/build/commands/device/view.ts)_
|
||||
_See code: [build/commands/device/view.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/device/view.ts)_
|
||||
|
||||
## `eas help [COMMAND]`
|
||||
|
||||
@@ -261,7 +261,7 @@ OPTIONS
|
||||
--value=value Value of the secret
|
||||
```
|
||||
|
||||
_See code: [build/commands/secret/create.ts](https://github.com/expo/eas-cli/blob/v0.10.0/build/commands/secret/create.ts)_
|
||||
_See code: [build/commands/secret/create.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/secret/create.ts)_
|
||||
|
||||
## `eas secret:delete`
|
||||
|
||||
@@ -278,18 +278,18 @@ 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.10.0/build/commands/secret/delete.ts)_
|
||||
_See code: [build/commands/secret/delete.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/secret/delete.ts)_
|
||||
|
||||
## `eas secrets:list`
|
||||
## `eas secret:list`
|
||||
|
||||
Lists environment secrets available for your current app
|
||||
|
||||
```
|
||||
USAGE
|
||||
$ eas secrets:list
|
||||
$ eas secret:list
|
||||
```
|
||||
|
||||
_See code: [build/commands/secret/list.ts](https://github.com/expo/eas-cli/blob/v0.10.0/build/commands/secret/list.ts)_
|
||||
_See code: [build/commands/secret/list.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/secret/list.ts)_
|
||||
|
||||
## `eas submit --platform=(android|ios)`
|
||||
|
||||
@@ -369,7 +369,7 @@ EXAMPLES
|
||||
and provide its App ID
|
||||
```
|
||||
|
||||
_See code: [build/commands/submit.ts](https://github.com/expo/eas-cli/blob/v0.10.0/build/commands/submit.ts)_
|
||||
_See code: [build/commands/submit.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/submit.ts)_
|
||||
|
||||
## `eas webhook:create`
|
||||
|
||||
@@ -388,7 +388,7 @@ OPTIONS
|
||||
--url=url Webhook URL
|
||||
```
|
||||
|
||||
_See code: [build/commands/webhook/create.ts](https://github.com/expo/eas-cli/blob/v0.10.0/build/commands/webhook/create.ts)_
|
||||
_See code: [build/commands/webhook/create.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/webhook/create.ts)_
|
||||
|
||||
## `eas webhook:delete [ID]`
|
||||
|
||||
@@ -402,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.10.0/build/commands/webhook/delete.ts)_
|
||||
_See code: [build/commands/webhook/delete.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/webhook/delete.ts)_
|
||||
|
||||
## `eas webhook:list`
|
||||
|
||||
@@ -416,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.10.0/build/commands/webhook/list.ts)_
|
||||
_See code: [build/commands/webhook/list.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/webhook/list.ts)_
|
||||
|
||||
## `eas webhook:update`
|
||||
|
||||
@@ -436,7 +436,7 @@ OPTIONS
|
||||
--url=url Webhook URL
|
||||
```
|
||||
|
||||
_See code: [build/commands/webhook/update.ts](https://github.com/expo/eas-cli/blob/v0.10.0/build/commands/webhook/update.ts)_
|
||||
_See code: [build/commands/webhook/update.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/webhook/update.ts)_
|
||||
|
||||
## `eas webhook:view ID`
|
||||
|
||||
@@ -450,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.10.0/build/commands/webhook/view.ts)_
|
||||
_See code: [build/commands/webhook/view.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/webhook/view.ts)_
|
||||
<!-- commandsstop -->
|
||||
@@ -6145,280 +6145,6 @@
|
||||
"enumValues": null,
|
||||
"possibleTypes": null
|
||||
},
|
||||
{
|
||||
"kind": "INPUT_OBJECT",
|
||||
"name": "SubmissionFilter",
|
||||
"description": "",
|
||||
"fields": null,
|
||||
"inputFields": [
|
||||
{
|
||||
"name": "platform",
|
||||
"description": "",
|
||||
"type": {
|
||||
"kind": "ENUM",
|
||||
"name": "AppPlatform",
|
||||
"ofType": null
|
||||
},
|
||||
"defaultValue": null
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"description": "",
|
||||
"type": {
|
||||
"kind": "ENUM",
|
||||
"name": "SubmissionStatus",
|
||||
"ofType": null
|
||||
},
|
||||
"defaultValue": null
|
||||
}
|
||||
],
|
||||
"interfaces": null,
|
||||
"enumValues": null,
|
||||
"possibleTypes": null
|
||||
},
|
||||
{
|
||||
"kind": "ENUM",
|
||||
"name": "SubmissionStatus",
|
||||
"description": "",
|
||||
"fields": null,
|
||||
"inputFields": null,
|
||||
"interfaces": null,
|
||||
"enumValues": [
|
||||
{
|
||||
"name": "IN_QUEUE",
|
||||
"description": "",
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "IN_PROGRESS",
|
||||
"description": "",
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "FINISHED",
|
||||
"description": "",
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "ERRORED",
|
||||
"description": "",
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
}
|
||||
],
|
||||
"possibleTypes": null
|
||||
},
|
||||
{
|
||||
"kind": "OBJECT",
|
||||
"name": "Submission",
|
||||
"description": "Represents an EAS Submission",
|
||||
"fields": [
|
||||
{
|
||||
"name": "id",
|
||||
"description": "",
|
||||
"args": [],
|
||||
"type": {
|
||||
"kind": "NON_NULL",
|
||||
"name": null,
|
||||
"ofType": {
|
||||
"kind": "SCALAR",
|
||||
"name": "ID",
|
||||
"ofType": null
|
||||
}
|
||||
},
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "actor",
|
||||
"description": "",
|
||||
"args": [],
|
||||
"type": {
|
||||
"kind": "INTERFACE",
|
||||
"name": "Actor",
|
||||
"ofType": null
|
||||
},
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "activityTimestamp",
|
||||
"description": "",
|
||||
"args": [],
|
||||
"type": {
|
||||
"kind": "NON_NULL",
|
||||
"name": null,
|
||||
"ofType": {
|
||||
"kind": "SCALAR",
|
||||
"name": "DateTime",
|
||||
"ofType": null
|
||||
}
|
||||
},
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "app",
|
||||
"description": "",
|
||||
"args": [],
|
||||
"type": {
|
||||
"kind": "OBJECT",
|
||||
"name": "App",
|
||||
"ofType": null
|
||||
},
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "initiatingActor",
|
||||
"description": "",
|
||||
"args": [],
|
||||
"type": {
|
||||
"kind": "INTERFACE",
|
||||
"name": "Actor",
|
||||
"ofType": null
|
||||
},
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "platform",
|
||||
"description": "",
|
||||
"args": [],
|
||||
"type": {
|
||||
"kind": "NON_NULL",
|
||||
"name": null,
|
||||
"ofType": {
|
||||
"kind": "ENUM",
|
||||
"name": "AppPlatform",
|
||||
"ofType": null
|
||||
}
|
||||
},
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"description": "",
|
||||
"args": [],
|
||||
"type": {
|
||||
"kind": "NON_NULL",
|
||||
"name": null,
|
||||
"ofType": {
|
||||
"kind": "ENUM",
|
||||
"name": "SubmissionStatus",
|
||||
"ofType": null
|
||||
}
|
||||
},
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "logsUrl",
|
||||
"description": "",
|
||||
"args": [],
|
||||
"type": {
|
||||
"kind": "SCALAR",
|
||||
"name": "String",
|
||||
"ofType": null
|
||||
},
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "error",
|
||||
"description": "",
|
||||
"args": [],
|
||||
"type": {
|
||||
"kind": "OBJECT",
|
||||
"name": "SubmissionError",
|
||||
"ofType": null
|
||||
},
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "createdAt",
|
||||
"description": "",
|
||||
"args": [],
|
||||
"type": {
|
||||
"kind": "NON_NULL",
|
||||
"name": null,
|
||||
"ofType": {
|
||||
"kind": "SCALAR",
|
||||
"name": "DateTime",
|
||||
"ofType": null
|
||||
}
|
||||
},
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "updatedAt",
|
||||
"description": "",
|
||||
"args": [],
|
||||
"type": {
|
||||
"kind": "NON_NULL",
|
||||
"name": null,
|
||||
"ofType": {
|
||||
"kind": "SCALAR",
|
||||
"name": "DateTime",
|
||||
"ofType": null
|
||||
}
|
||||
},
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
}
|
||||
],
|
||||
"inputFields": null,
|
||||
"interfaces": [
|
||||
{
|
||||
"kind": "INTERFACE",
|
||||
"name": "ActivityTimelineProjectActivity",
|
||||
"ofType": null
|
||||
}
|
||||
],
|
||||
"enumValues": null,
|
||||
"possibleTypes": null
|
||||
},
|
||||
{
|
||||
"kind": "OBJECT",
|
||||
"name": "SubmissionError",
|
||||
"description": "",
|
||||
"fields": [
|
||||
{
|
||||
"name": "errorCode",
|
||||
"description": "",
|
||||
"args": [],
|
||||
"type": {
|
||||
"kind": "SCALAR",
|
||||
"name": "String",
|
||||
"ofType": null
|
||||
},
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "message",
|
||||
"description": "",
|
||||
"args": [],
|
||||
"type": {
|
||||
"kind": "SCALAR",
|
||||
"name": "String",
|
||||
"ofType": null
|
||||
},
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
}
|
||||
],
|
||||
"inputFields": null,
|
||||
"interfaces": [],
|
||||
"enumValues": null,
|
||||
"possibleTypes": null
|
||||
},
|
||||
{
|
||||
"kind": "INPUT_OBJECT",
|
||||
"name": "IosAppCredentialsFilter",
|
||||
@@ -11135,48 +10861,6 @@
|
||||
"enumValues": null,
|
||||
"possibleTypes": null
|
||||
},
|
||||
{
|
||||
"kind": "OBJECT",
|
||||
"name": "SubmissionQuery",
|
||||
"description": "",
|
||||
"fields": [
|
||||
{
|
||||
"name": "byId",
|
||||
"description": "Look up EAS Submission by submission ID",
|
||||
"args": [
|
||||
{
|
||||
"name": "submissionId",
|
||||
"description": null,
|
||||
"type": {
|
||||
"kind": "NON_NULL",
|
||||
"name": null,
|
||||
"ofType": {
|
||||
"kind": "SCALAR",
|
||||
"name": "ID",
|
||||
"ofType": null
|
||||
}
|
||||
},
|
||||
"defaultValue": null
|
||||
}
|
||||
],
|
||||
"type": {
|
||||
"kind": "NON_NULL",
|
||||
"name": null,
|
||||
"ofType": {
|
||||
"kind": "OBJECT",
|
||||
"name": "Submission",
|
||||
"ofType": null
|
||||
}
|
||||
},
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
}
|
||||
],
|
||||
"inputFields": null,
|
||||
"interfaces": [],
|
||||
"enumValues": null,
|
||||
"possibleTypes": null
|
||||
},
|
||||
{
|
||||
"kind": "OBJECT",
|
||||
"name": "UserInvitationPublicDataQuery",
|
||||
@@ -15868,6 +15552,16 @@
|
||||
},
|
||||
"defaultValue": null
|
||||
},
|
||||
{
|
||||
"name": "buildType",
|
||||
"description": "",
|
||||
"type": {
|
||||
"kind": "ENUM",
|
||||
"name": "AndroidManagedBuildType",
|
||||
"ofType": null
|
||||
},
|
||||
"defaultValue": null
|
||||
},
|
||||
{
|
||||
"name": "username",
|
||||
"description": "",
|
||||
@@ -15883,6 +15577,35 @@
|
||||
"enumValues": null,
|
||||
"possibleTypes": null
|
||||
},
|
||||
{
|
||||
"kind": "ENUM",
|
||||
"name": "AndroidManagedBuildType",
|
||||
"description": "",
|
||||
"fields": null,
|
||||
"inputFields": null,
|
||||
"interfaces": null,
|
||||
"enumValues": [
|
||||
{
|
||||
"name": "APK",
|
||||
"description": "",
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "APP_BUNDLE",
|
||||
"description": "",
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "DEVELOPMENT_CLIENT",
|
||||
"description": "",
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
}
|
||||
],
|
||||
"possibleTypes": null
|
||||
},
|
||||
{
|
||||
"kind": "INPUT_OBJECT",
|
||||
"name": "IosGenericJobInput",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "eas-cli",
|
||||
"description": "EAS command line tool",
|
||||
"version": "0.10.0",
|
||||
"version": "0.11.0",
|
||||
"author": "Expo <[email protected]>",
|
||||
"bin": {
|
||||
"eas": "./bin/run"
|
||||
@@ -14,7 +14,7 @@
|
||||
"@expo/config": "~3.3.19",
|
||||
"@expo/config-plugins": "1.0.24",
|
||||
"@expo/eas-build-job": "0.2.22",
|
||||
"@expo/eas-json": "^0.10.0",
|
||||
"@expo/eas-json": "^0.11.0",
|
||||
"@expo/json-file": "^8.2.24",
|
||||
"@expo/plist": "^0.0.11",
|
||||
"@expo/plugin-warn-if-update-available": "^1.7.0",
|
||||
|
||||
@@ -1,294 +0,0 @@
|
||||
import { Workflow } from '@expo/eas-build-job';
|
||||
import { CredentialsSource } from '@expo/eas-json';
|
||||
import prompts from 'prompts';
|
||||
|
||||
import { asMock } from '../../__tests__/utils';
|
||||
import { CredentialsProvider } from '../../credentials/CredentialsProvider';
|
||||
import { ensureCredentialsAsync } from '../credentials';
|
||||
|
||||
jest.mock('prompts');
|
||||
|
||||
function createMockCredentialsProvider({
|
||||
hasRemote,
|
||||
hasLocal,
|
||||
isLocalSynced,
|
||||
}: any): CredentialsProvider {
|
||||
return {
|
||||
platform: 'android',
|
||||
hasRemoteAsync: jest.fn().mockImplementation(() => hasRemote || false),
|
||||
hasLocalAsync: jest.fn().mockImplementation(() => hasLocal || false),
|
||||
isLocalSyncedAsync: jest.fn().mockImplementation(() => isLocalSynced || false),
|
||||
} as CredentialsProvider;
|
||||
}
|
||||
|
||||
const originalConsoleLog = console.log;
|
||||
const originalConsoleWarn = console.warn;
|
||||
beforeAll(() => {
|
||||
console.log = jest.fn();
|
||||
console.warn = jest.fn();
|
||||
});
|
||||
afterAll(() => {
|
||||
console.log = originalConsoleLog;
|
||||
console.warn = originalConsoleWarn;
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
asMock(prompts).mockReset();
|
||||
asMock(prompts).mockImplementation(() => {
|
||||
throw new Error(`unhandled prompts call - this shouldn't happen - fix tests!`);
|
||||
});
|
||||
});
|
||||
|
||||
describe(ensureCredentialsAsync, () => {
|
||||
describe('for generic builds', () => {
|
||||
it("should use credentials.json if it's the only available credentials", async () => {
|
||||
const provider = createMockCredentialsProvider({
|
||||
hasRemote: false,
|
||||
hasLocal: true,
|
||||
});
|
||||
const src = await ensureCredentialsAsync(
|
||||
provider,
|
||||
Workflow.GENERIC,
|
||||
CredentialsSource.AUTO,
|
||||
false
|
||||
);
|
||||
expect(src).toBe('local');
|
||||
});
|
||||
it("should use credentials from server if it's the only available credentials", async () => {
|
||||
const provider = createMockCredentialsProvider({
|
||||
hasRemote: true,
|
||||
hasLocal: false,
|
||||
});
|
||||
const src = await ensureCredentialsAsync(
|
||||
provider,
|
||||
Workflow.GENERIC,
|
||||
CredentialsSource.AUTO,
|
||||
false
|
||||
);
|
||||
expect(src).toBe('remote');
|
||||
});
|
||||
it('should use credentials.json if credentials are the same in credentials.json and on server', async () => {
|
||||
const provider = createMockCredentialsProvider({
|
||||
hasRemote: true,
|
||||
hasLocal: true,
|
||||
isLocalSynced: true,
|
||||
});
|
||||
const src = await ensureCredentialsAsync(
|
||||
provider,
|
||||
Workflow.GENERIC,
|
||||
CredentialsSource.AUTO,
|
||||
false
|
||||
);
|
||||
expect(prompts).toHaveBeenCalledTimes(0);
|
||||
expect(src).toBe('local');
|
||||
});
|
||||
it('should ask which credentials to use when local and remote crednitals have different values', async () => {
|
||||
const provider = createMockCredentialsProvider({
|
||||
hasRemote: true,
|
||||
hasLocal: true,
|
||||
isLocalSynced: false,
|
||||
});
|
||||
asMock(prompts).mockImplementationOnce(() => {
|
||||
return { select: 'local' };
|
||||
});
|
||||
const src = await ensureCredentialsAsync(
|
||||
provider,
|
||||
Workflow.GENERIC,
|
||||
CredentialsSource.AUTO,
|
||||
false
|
||||
);
|
||||
expect(prompts).toHaveBeenCalledTimes(1);
|
||||
expect(src).toBe('local');
|
||||
});
|
||||
it('should ask when local and remote are not the same (select remote)', async () => {
|
||||
const provider = createMockCredentialsProvider({
|
||||
hasRemote: true,
|
||||
hasLocal: true,
|
||||
isLocalSynced: false,
|
||||
});
|
||||
asMock(prompts).mockImplementationOnce(() => {
|
||||
return { select: 'remote' };
|
||||
});
|
||||
const src = await ensureCredentialsAsync(
|
||||
provider,
|
||||
Workflow.GENERIC,
|
||||
CredentialsSource.AUTO,
|
||||
false
|
||||
);
|
||||
expect(prompts).toHaveBeenCalledTimes(1);
|
||||
expect(src).toBe('remote');
|
||||
});
|
||||
it('should should throw an error when local and remote are not the same (in non interactive mode)', async () => {
|
||||
const provider = createMockCredentialsProvider({
|
||||
hasRemote: true,
|
||||
hasLocal: true,
|
||||
isLocalSynced: false,
|
||||
});
|
||||
|
||||
try {
|
||||
await ensureCredentialsAsync(provider, Workflow.GENERIC, CredentialsSource.AUTO, true);
|
||||
throw new Error('ensureCredentialsAsync should throw an Error');
|
||||
} catch (e) {
|
||||
expect(e.message).toMatch(
|
||||
'Contents of your local credentials.json for Android are not the same as credentials on EAS servers'
|
||||
);
|
||||
}
|
||||
|
||||
expect(prompts).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
it('should ask when no credentials are present and return remote if confirm=true', async () => {
|
||||
const provider = createMockCredentialsProvider({
|
||||
hasRemote: false,
|
||||
hasLocal: false,
|
||||
isLocalSynced: false,
|
||||
});
|
||||
asMock(prompts).mockImplementationOnce(() => {
|
||||
return { value: true }; //confirm
|
||||
});
|
||||
const src = await ensureCredentialsAsync(
|
||||
provider,
|
||||
Workflow.GENERIC,
|
||||
CredentialsSource.AUTO,
|
||||
false
|
||||
);
|
||||
expect(prompts).toHaveBeenCalledTimes(1);
|
||||
expect(src).toBe('remote');
|
||||
});
|
||||
it('should ask when no credentials are present and abort if confimr=false', async () => {
|
||||
const provider = createMockCredentialsProvider({
|
||||
hasRemote: false,
|
||||
hasLocal: false,
|
||||
isLocalSynced: false,
|
||||
});
|
||||
asMock(prompts).mockImplementationOnce(() => {
|
||||
return { value: false }; //confirm
|
||||
});
|
||||
|
||||
try {
|
||||
await ensureCredentialsAsync(provider, Workflow.GENERIC, CredentialsSource.AUTO, false);
|
||||
throw new Error('ensureCredentialsAsync should throw an Error');
|
||||
} catch (e) {
|
||||
expect(e.message).toMatch(
|
||||
'Aborting build process, credentials are not configured for Android'
|
||||
);
|
||||
}
|
||||
|
||||
expect(prompts).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
it('should throw an error when no credentials are present in non interactive mode', async () => {
|
||||
const provider = createMockCredentialsProvider({
|
||||
hasRemote: false,
|
||||
hasLocal: false,
|
||||
isLocalSynced: false,
|
||||
});
|
||||
asMock(prompts).mockImplementation(() => {
|
||||
return { value: true }; // confirm
|
||||
});
|
||||
|
||||
try {
|
||||
await ensureCredentialsAsync(provider, Workflow.GENERIC, CredentialsSource.AUTO, true);
|
||||
throw new Error('ensureCredentialsAsync should throw an Error');
|
||||
} catch (e) {
|
||||
expect(e.message).toMatch('Credentials for this app are not configured');
|
||||
}
|
||||
|
||||
expect(prompts).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('for managed builds', () => {
|
||||
it("should use credentials.json if it's the only available credentials", async () => {
|
||||
const provider = createMockCredentialsProvider({
|
||||
hasRemote: false,
|
||||
hasLocal: true,
|
||||
});
|
||||
const src = await ensureCredentialsAsync(
|
||||
provider,
|
||||
Workflow.MANAGED,
|
||||
CredentialsSource.AUTO,
|
||||
false
|
||||
);
|
||||
expect(src).toBe('local');
|
||||
});
|
||||
it("should use credentials from server if it's the only available credentials", async () => {
|
||||
const provider = createMockCredentialsProvider({
|
||||
hasRemote: true,
|
||||
hasLocal: false,
|
||||
});
|
||||
const src = await ensureCredentialsAsync(
|
||||
provider,
|
||||
Workflow.MANAGED,
|
||||
CredentialsSource.AUTO,
|
||||
false
|
||||
);
|
||||
expect(src).toBe('remote');
|
||||
});
|
||||
it('should use credentials.json if credentials are the same in credentials.json and on server', async () => {
|
||||
const provider = createMockCredentialsProvider({
|
||||
hasRemote: true,
|
||||
hasLocal: true,
|
||||
isLocalSynced: true,
|
||||
});
|
||||
const src = await ensureCredentialsAsync(
|
||||
provider,
|
||||
Workflow.MANAGED,
|
||||
CredentialsSource.AUTO,
|
||||
false
|
||||
);
|
||||
expect(prompts).toHaveBeenCalledTimes(0);
|
||||
expect(src).toBe('local');
|
||||
});
|
||||
|
||||
it('should use credentials.json even if credentials on server are different', async () => {
|
||||
const provider = createMockCredentialsProvider({
|
||||
hasRemote: true,
|
||||
hasLocal: true,
|
||||
isLocalSynced: false,
|
||||
});
|
||||
const src = await ensureCredentialsAsync(
|
||||
provider,
|
||||
Workflow.MANAGED,
|
||||
CredentialsSource.AUTO,
|
||||
false
|
||||
);
|
||||
expect(prompts).toHaveBeenCalledTimes(0);
|
||||
expect(src).toBe('local');
|
||||
});
|
||||
});
|
||||
|
||||
describe('generic builds with credentialsSource set to local', () => {
|
||||
it('should use credentials.json without asking even if credentials on server are different', async () => {
|
||||
const provider = createMockCredentialsProvider({
|
||||
hasRemote: true,
|
||||
hasLocal: true,
|
||||
isLocalSynced: false,
|
||||
});
|
||||
const src = await ensureCredentialsAsync(
|
||||
provider,
|
||||
Workflow.GENERIC,
|
||||
CredentialsSource.LOCAL,
|
||||
false
|
||||
);
|
||||
expect(prompts).toHaveBeenCalledTimes(0);
|
||||
expect(src).toBe('local');
|
||||
});
|
||||
});
|
||||
|
||||
describe('generic builds with credentialsSource set to remote', () => {
|
||||
it('should use credentials from server even if credentials.json exists and have different values', async () => {
|
||||
const provider = createMockCredentialsProvider({
|
||||
hasRemote: true,
|
||||
hasLocal: true,
|
||||
isLocalSynced: false,
|
||||
});
|
||||
const src = await ensureCredentialsAsync(
|
||||
provider,
|
||||
Workflow.GENERIC,
|
||||
CredentialsSource.REMOTE,
|
||||
false
|
||||
);
|
||||
expect(prompts).toHaveBeenCalledTimes(0);
|
||||
expect(src).toBe('remote');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -13,9 +13,9 @@ import Log from '../../log';
|
||||
import { toggleConfirmAsync } from '../../prompts';
|
||||
import { CredentialsResult, prepareBuildRequestForPlatformAsync } from '../build';
|
||||
import { BuildContext, CommandContext, createBuildContext } from '../context';
|
||||
import { ensureCredentialsAsync } from '../credentials';
|
||||
import { transformMetadata } from '../graphql';
|
||||
import { Platform } from '../types';
|
||||
import { logCredentialsSource } from '../utils/credentials';
|
||||
import { ensureApplicationIdIsValidAsync } from './applicationId';
|
||||
import { validateAndSyncProjectConfigurationAsync } from './configure';
|
||||
import { transformGenericJob, transformManagedJob } from './graphql';
|
||||
@@ -125,12 +125,8 @@ async function ensureAndroidCredentialsAsync(
|
||||
skipCredentialsCheck: ctx.commandCtx.skipCredentialsCheck,
|
||||
}
|
||||
);
|
||||
const credentialsSource = await ensureCredentialsAsync(
|
||||
provider,
|
||||
ctx.buildProfile.workflow,
|
||||
ctx.buildProfile.credentialsSource,
|
||||
ctx.commandCtx.nonInteractive
|
||||
);
|
||||
const { credentialsSource } = ctx.buildProfile;
|
||||
logCredentialsSource(credentialsSource, Platform.ANDROID);
|
||||
return {
|
||||
credentials: await provider.getCredentialsAsync(credentialsSource),
|
||||
source: credentialsSource,
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import { Android } from '@expo/eas-build-job';
|
||||
|
||||
import { AndroidGenericJobInput, AndroidManagedJobInput } from '../../graphql/generated';
|
||||
import {
|
||||
AndroidGenericJobInput,
|
||||
AndroidManagedBuildType,
|
||||
AndroidManagedJobInput,
|
||||
} from '../../graphql/generated';
|
||||
import { transformProjectArchive } from '../graphql';
|
||||
|
||||
export function transformGenericJob(job: Android.GenericJob): AndroidGenericJobInput {
|
||||
@@ -25,5 +29,16 @@ export function transformManagedJob(job: Android.ManagedJob): AndroidManagedJobI
|
||||
builderEnvironment: job.builderEnvironment,
|
||||
cache: job.cache,
|
||||
username: job.username,
|
||||
buildType: transformBuildType(job.buildType),
|
||||
};
|
||||
}
|
||||
|
||||
function transformBuildType(buildType: Android.ManagedBuildType): AndroidManagedBuildType {
|
||||
if (buildType === Android.ManagedBuildType.APK) {
|
||||
return AndroidManagedBuildType.Apk;
|
||||
} else if (buildType === Android.ManagedBuildType.APP_BUNDLE) {
|
||||
return AndroidManagedBuildType.AppBundle;
|
||||
} else {
|
||||
return AndroidManagedBuildType.DevelopmentClient;
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
import { Platform, Workflow } from '@expo/eas-build-job';
|
||||
import { CredentialsSource } from '@expo/eas-json';
|
||||
import chalk from 'chalk';
|
||||
|
||||
import { CredentialsProvider } from '../credentials/CredentialsProvider';
|
||||
import Log from '../log';
|
||||
import { confirmAsync, promptAsync } from '../prompts';
|
||||
import { requestedPlatformDisplayNames } from './constants';
|
||||
|
||||
function logCredentials(target: 'local' | 'remote', platform: Platform) {
|
||||
let message = `Using ${target} ${requestedPlatformDisplayNames[platform]} credentials`;
|
||||
if (target === 'local') message += ` ${chalk.dim('(credentials.json)')}`;
|
||||
if (target === 'remote') message += ` ${chalk.dim('(Expo server)')}`;
|
||||
Log.succeed(message);
|
||||
}
|
||||
|
||||
async function ensureCredentialsAutoAsync(
|
||||
provider: CredentialsProvider,
|
||||
workflow: Workflow,
|
||||
nonInteractive: boolean
|
||||
): Promise<CredentialsSource.LOCAL | CredentialsSource.REMOTE> {
|
||||
const platform = requestedPlatformDisplayNames[provider.platform];
|
||||
switch (workflow) {
|
||||
case Workflow.MANAGED:
|
||||
if (await provider.hasLocalAsync()) {
|
||||
return CredentialsSource.LOCAL;
|
||||
} else {
|
||||
return CredentialsSource.REMOTE;
|
||||
}
|
||||
case Workflow.GENERIC: {
|
||||
const hasLocal = await provider.hasLocalAsync();
|
||||
const hasRemote = await provider.hasRemoteAsync();
|
||||
if (hasRemote && hasLocal) {
|
||||
if (!(await provider.isLocalSyncedAsync())) {
|
||||
if (nonInteractive) {
|
||||
throw new Error(
|
||||
`Contents of your local credentials.json for ${platform} are not the same as credentials on EAS servers. To use the desired credentials, set the "builds.${platform}.{profile}.credentialsSource" field in the credentials.json file to one of the following: "local", "remote".`
|
||||
);
|
||||
} else {
|
||||
Log.log(
|
||||
`Contents of your local credentials.json for ${platform} are not the same as credentials on EAS servers`
|
||||
);
|
||||
}
|
||||
|
||||
const { select } = await promptAsync({
|
||||
type: 'select',
|
||||
name: 'select',
|
||||
message: 'Which credentials do you want to use for this build?',
|
||||
choices: [
|
||||
{ title: 'Local credentials.json', value: CredentialsSource.LOCAL },
|
||||
{ title: 'Credentials stored on EAS servers.', value: CredentialsSource.REMOTE },
|
||||
],
|
||||
});
|
||||
return select;
|
||||
} else {
|
||||
return CredentialsSource.LOCAL;
|
||||
}
|
||||
} else if (hasLocal) {
|
||||
logCredentials('local', provider.platform);
|
||||
return CredentialsSource.LOCAL;
|
||||
} else if (hasRemote) {
|
||||
logCredentials('remote', provider.platform);
|
||||
return CredentialsSource.REMOTE;
|
||||
} else {
|
||||
if (nonInteractive) {
|
||||
throw new Error(
|
||||
`Credentials for this app are not configured and there is no entry in credentials.json for ${platform}. Either configure credentials.json, or launch the build without "--non-interactive" flag to get a prompt to generate credentials automatically.`
|
||||
);
|
||||
} else if (Log.isDebug) {
|
||||
Log.warn(
|
||||
`Credentials for this app are not configured and there is no entry in credentials.json for ${platform}`
|
||||
);
|
||||
}
|
||||
|
||||
const confirm = await confirmAsync({
|
||||
message: `${platform} credentials not found, generate now?`,
|
||||
});
|
||||
if (confirm) {
|
||||
return CredentialsSource.REMOTE;
|
||||
} else {
|
||||
throw new Error(`Aborting build process, credentials are not configured for ${platform}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function ensureCredentialsAsync(
|
||||
provider: CredentialsProvider,
|
||||
workflow: Workflow,
|
||||
src: CredentialsSource,
|
||||
nonInteractive: boolean
|
||||
): Promise<CredentialsSource.LOCAL | CredentialsSource.REMOTE> {
|
||||
switch (src) {
|
||||
case CredentialsSource.LOCAL:
|
||||
logCredentials('local', provider.platform);
|
||||
return CredentialsSource.LOCAL;
|
||||
case CredentialsSource.REMOTE:
|
||||
logCredentials('remote', provider.platform);
|
||||
return CredentialsSource.REMOTE;
|
||||
case CredentialsSource.AUTO:
|
||||
return await ensureCredentialsAutoAsync(provider, workflow, nonInteractive);
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,8 @@ import { getAppLookupParamsFromContext } from '../../credentials/ios/actions/new
|
||||
import { AppLookupParams } from '../../credentials/ios/credentials';
|
||||
import { CredentialsResult } from '../build';
|
||||
import { BuildContext } from '../context';
|
||||
import { ensureCredentialsAsync } from '../credentials';
|
||||
import { Platform } from '../types';
|
||||
import { logCredentialsSource } from '../utils/credentials';
|
||||
|
||||
export async function ensureIosCredentialsAsync(
|
||||
ctx: BuildContext<Platform.IOS>
|
||||
@@ -59,12 +59,8 @@ export async function resolveIosCredentialsAsync(
|
||||
enterpriseProvisioning: params.enterpriseProvisioning,
|
||||
skipCredentialsCheck: params.skipCredentialsCheck,
|
||||
});
|
||||
const credentialsSource = await ensureCredentialsAsync(
|
||||
provider,
|
||||
params.workflow,
|
||||
params.credentialsSource,
|
||||
params.nonInteractive
|
||||
);
|
||||
const { credentialsSource } = params;
|
||||
logCredentialsSource(credentialsSource, Platform.IOS);
|
||||
return {
|
||||
credentials: await provider.getCredentialsAsync(credentialsSource),
|
||||
source: credentialsSource,
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Platform } from '@expo/eas-build-job';
|
||||
import { CredentialsSource } from '@expo/eas-json';
|
||||
import chalk from 'chalk';
|
||||
|
||||
import Log from '../../log';
|
||||
import { requestedPlatformDisplayNames } from '../constants';
|
||||
|
||||
export function logCredentialsSource(credentialsSource: CredentialsSource, platform: Platform) {
|
||||
let message = `Using ${credentialsSource} ${requestedPlatformDisplayNames[platform]} credentials`;
|
||||
if (credentialsSource === CredentialsSource.LOCAL)
|
||||
message += ` ${chalk.dim('(credentials.json)')}`;
|
||||
else if (credentialsSource === CredentialsSource.REMOTE)
|
||||
message += ` ${chalk.dim('(Expo server)')}`;
|
||||
Log.succeed(message);
|
||||
}
|
||||
@@ -20,7 +20,6 @@ import { ensureLoggedInAsync } from '../../user/actions';
|
||||
|
||||
export default class EnvironmentSecretList extends Command {
|
||||
static description = 'Lists environment secrets available for your current app';
|
||||
static usage = 'secrets:list';
|
||||
|
||||
async run(): Promise<void> {
|
||||
await ensureLoggedInAsync();
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
import { Platform } from '@expo/eas-build-job';
|
||||
|
||||
export interface CredentialsProvider {
|
||||
platform: Platform;
|
||||
hasRemoteAsync(): Promise<boolean>;
|
||||
hasLocalAsync(): Promise<boolean>;
|
||||
isLocalSyncedAsync(): Promise<boolean>;
|
||||
}
|
||||
@@ -1,9 +1,7 @@
|
||||
import { Platform } from '@expo/eas-build-job';
|
||||
import { CredentialsSource } from '@expo/eas-json';
|
||||
|
||||
import Log from '../../log';
|
||||
import { CredentialsManager } from '../CredentialsManager';
|
||||
import { CredentialsProvider } from '../CredentialsProvider';
|
||||
import { Context } from '../context';
|
||||
import * as credentialsJsonReader from '../credentialsJson/read';
|
||||
import { SetupBuildCredentials } from './actions/SetupBuildCredentials';
|
||||
@@ -23,7 +21,7 @@ interface Options {
|
||||
skipCredentialsCheck?: boolean;
|
||||
}
|
||||
|
||||
export default class AndroidCredentialsProvider implements CredentialsProvider {
|
||||
export default class AndroidCredentialsProvider {
|
||||
public readonly platform = Platform.ANDROID;
|
||||
|
||||
constructor(private ctx: Context, private options: Options) {}
|
||||
@@ -33,45 +31,6 @@ export default class AndroidCredentialsProvider implements CredentialsProvider {
|
||||
return `@${accountName}/${projectName}`;
|
||||
}
|
||||
|
||||
public async hasRemoteAsync(): Promise<boolean> {
|
||||
const keystore = await this.ctx.android.fetchKeystoreAsync(this.projectFullName);
|
||||
return !!keystore;
|
||||
}
|
||||
|
||||
public async hasLocalAsync(): Promise<boolean> {
|
||||
if (!(await credentialsJsonReader.fileExistsAsync(this.ctx.projectDir))) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
const rawCredentialsJson = await credentialsJsonReader.readRawAsync(this.ctx.projectDir);
|
||||
return !!rawCredentialsJson?.android;
|
||||
} catch (err) {
|
||||
Log.error(err); // malformed json
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public async isLocalSyncedAsync(): Promise<boolean> {
|
||||
try {
|
||||
const [remote, local] = await Promise.all([
|
||||
this.ctx.android.fetchKeystoreAsync(this.projectFullName),
|
||||
credentialsJsonReader.readAndroidCredentialsAsync(this.ctx.projectDir),
|
||||
]);
|
||||
const r = remote;
|
||||
const l = local?.keystore;
|
||||
return !!(
|
||||
r &&
|
||||
l &&
|
||||
r.keystore === l.keystore &&
|
||||
r.keystorePassword === l.keystorePassword &&
|
||||
r.keyAlias === l.keyAlias &&
|
||||
r.keyPassword === l.keyPassword
|
||||
);
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public async getCredentialsAsync(
|
||||
src: CredentialsSource.LOCAL | CredentialsSource.REMOTE
|
||||
): Promise<AndroidCredentials> {
|
||||
@@ -81,7 +40,6 @@ export default class AndroidCredentialsProvider implements CredentialsProvider {
|
||||
case CredentialsSource.REMOTE:
|
||||
return await this.getRemoteAsync();
|
||||
}
|
||||
throw new Error('Unknown');
|
||||
}
|
||||
|
||||
private async getRemoteAsync(): Promise<AndroidCredentials> {
|
||||
|
||||
@@ -4,7 +4,6 @@ import { CredentialsSource, IosDistributionType, IosEnterpriseProvisioning } fro
|
||||
import { IosAppBuildCredentialsFragment } from '../../graphql/generated';
|
||||
import Log from '../../log';
|
||||
import { CredentialsManager } from '../CredentialsManager';
|
||||
import { CredentialsProvider } from '../CredentialsProvider';
|
||||
import { Context } from '../context';
|
||||
import * as credentialsJsonReader from '../credentialsJson/read';
|
||||
import type { IosCredentials } from '../credentialsJson/read';
|
||||
@@ -25,64 +24,11 @@ interface Options {
|
||||
skipCredentialsCheck?: boolean;
|
||||
}
|
||||
|
||||
export default class IosCredentialsProvider implements CredentialsProvider {
|
||||
export default class IosCredentialsProvider {
|
||||
public readonly platform = Platform.IOS;
|
||||
|
||||
constructor(private ctx: Context, private options: Options) {}
|
||||
|
||||
public async hasRemoteAsync(): Promise<boolean> {
|
||||
// TODO: this is temporary
|
||||
// remove this check when we implement syncing local credentials for internal distribution
|
||||
if (this.options.distribution === 'internal' && (await this.hasLocalAsync())) {
|
||||
return false;
|
||||
}
|
||||
const buildCredentials = await this.fetchRemoteAsync();
|
||||
return !!(
|
||||
buildCredentials?.distributionCertificate?.certificateP12 ||
|
||||
buildCredentials?.distributionCertificate?.certificatePassword ||
|
||||
buildCredentials?.provisioningProfile?.provisioningProfile
|
||||
);
|
||||
}
|
||||
|
||||
public async hasLocalAsync(): Promise<boolean> {
|
||||
if (!(await credentialsJsonReader.fileExistsAsync(this.ctx.projectDir))) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
const rawCredentialsJson = await credentialsJsonReader.readRawAsync(this.ctx.projectDir);
|
||||
return !!rawCredentialsJson?.ios;
|
||||
} catch (err) {
|
||||
Log.error(err); // malformed json
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public async isLocalSyncedAsync(): Promise<boolean> {
|
||||
try {
|
||||
const [remote, local] = await Promise.all([this.fetchRemoteAsync(), this.getLocalAsync()]);
|
||||
const r = remote;
|
||||
const l = local;
|
||||
|
||||
// TODO
|
||||
// For now, when credentials.json contains credentials for multi-target project
|
||||
// assume they are synced with the Expo servers.
|
||||
// Change this behavior when we figure out how to store multi-target project credentials in the db.
|
||||
if (credentialsJsonReader.isCredentialsMap(l)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return !!(
|
||||
r &&
|
||||
l &&
|
||||
r.provisioningProfile?.provisioningProfile === l.provisioningProfile &&
|
||||
r.distributionCertificate?.certificateP12 === l.distributionCertificate.certP12 &&
|
||||
r.distributionCertificate?.certificatePassword === l.distributionCertificate.certPassword
|
||||
);
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public async getCredentialsAsync(
|
||||
src: CredentialsSource.LOCAL | CredentialsSource.REMOTE
|
||||
): Promise<IosCredentials> {
|
||||
|
||||
@@ -23,71 +23,6 @@ beforeEach(() => {
|
||||
});
|
||||
|
||||
describe(IosCredentialsProvider, () => {
|
||||
describe('#hasRemoteAsync', () => {
|
||||
it('returns false when distribution === internal and there are local credentials', async () => {
|
||||
vol.fromJSON(
|
||||
{
|
||||
'./credentials.json': JSON.stringify({
|
||||
ios: {
|
||||
provisioningProfilePath: './ios/certs/profile.mobileprovision',
|
||||
distributionCertificate: {
|
||||
path: './ios/certs/cert.p12',
|
||||
password: 'cert-password',
|
||||
},
|
||||
},
|
||||
}),
|
||||
},
|
||||
'/app'
|
||||
);
|
||||
const ctx = createCtxMock({
|
||||
nonInteractive: false,
|
||||
appStore: getAppstoreMock(),
|
||||
projectDir: '/app',
|
||||
});
|
||||
|
||||
const appLookupParams = getAppLookupParamsFromContext(ctx);
|
||||
const provider = new IosCredentialsProvider(ctx, {
|
||||
app: {
|
||||
account: {
|
||||
id: `id-${appLookupParams.account.name}`,
|
||||
name: appLookupParams.account.name,
|
||||
},
|
||||
bundleIdentifier: appLookupParams.bundleIdentifier,
|
||||
projectName: appLookupParams.projectName,
|
||||
},
|
||||
distribution: 'internal',
|
||||
});
|
||||
await expect(provider.hasRemoteAsync()).resolves.toBe(false);
|
||||
});
|
||||
|
||||
it('returns true when there are remote credentials', async () => {
|
||||
const ctx = createCtxMock({
|
||||
nonInteractive: false,
|
||||
appStore: getAppstoreMock(),
|
||||
projectDir: '/app',
|
||||
newIos: {
|
||||
...getNewIosApiMockWithoutCredentials(),
|
||||
getIosAppCredentialsWithBuildCredentialsAsync: jest.fn(
|
||||
() => testIosAppCredentialsWithBuildCredentialsQueryResult
|
||||
),
|
||||
},
|
||||
});
|
||||
const appLookupParams = getAppLookupParamsFromContext(ctx);
|
||||
const provider = new IosCredentialsProvider(ctx, {
|
||||
app: {
|
||||
account: {
|
||||
id: `id-${appLookupParams.account.name}`,
|
||||
name: appLookupParams.account.name,
|
||||
},
|
||||
bundleIdentifier: appLookupParams.bundleIdentifier,
|
||||
projectName: appLookupParams.projectName,
|
||||
},
|
||||
distribution: 'store',
|
||||
});
|
||||
await expect(provider.hasRemoteAsync()).resolves.toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getCredentialsAsync', () => {
|
||||
describe('remote credentials', () => {
|
||||
it('throws an error is credentials do not exist', async () => {
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import { AppleDevice } from '../../../../graphql/generated';
|
||||
import { AppleDevice, AppleDeviceFragment } from '../../../../graphql/generated';
|
||||
import { APPLE_DEVICE_CLASS_LABELS } from '../../../../graphql/types/credentials/AppleDevice';
|
||||
import { promptAsync } from '../../.././../prompts';
|
||||
import { AppleDeviceFragmentWithAppleTeam } from '../../api/graphql/queries/AppleDeviceQuery';
|
||||
|
||||
export async function chooseDevices(
|
||||
allDevices: AppleDeviceFragmentWithAppleTeam[],
|
||||
allDevices: AppleDeviceFragment[],
|
||||
preselectedDeviceIdentifiers: string[] = []
|
||||
): Promise<AppleDevice[]> {
|
||||
const preselectedDeviceIdentifierSet = new Set(preselectedDeviceIdentifiers);
|
||||
const isSelected = (device: AppleDeviceFragmentWithAppleTeam) =>
|
||||
const isSelected = (device: AppleDeviceFragment) =>
|
||||
preselectedDeviceIdentifierSet.size === 0 ||
|
||||
preselectedDeviceIdentifierSet.has(device.identifier);
|
||||
const { devices } = await promptAsync({
|
||||
@@ -27,12 +26,12 @@ export async function chooseDevices(
|
||||
return devices;
|
||||
}
|
||||
|
||||
function formatDeviceLabel(device: AppleDeviceFragmentWithAppleTeam): string {
|
||||
export function formatDeviceLabel(device: AppleDeviceFragment): string {
|
||||
const deviceDetails = formatDeviceDetails(device);
|
||||
return `${device.name ?? device.identifier}${deviceDetails !== '' ? ` ${deviceDetails}` : ''}`;
|
||||
}
|
||||
|
||||
function formatDeviceDetails(device: AppleDeviceFragmentWithAppleTeam): string {
|
||||
function formatDeviceDetails(device: AppleDeviceFragment): string {
|
||||
let details = '';
|
||||
if (device.deviceClass) {
|
||||
details += APPLE_DEVICE_CLASS_LABELS[device.deviceClass];
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
import isEqual from 'lodash/isEqual';
|
||||
|
||||
import { AppleDistributionCertificateFragment } from '../../../../graphql/generated';
|
||||
import Log from '../../../../log';
|
||||
import { AppleDeviceFragmentWithAppleTeam } from '../../api/graphql/queries/AppleDeviceQuery';
|
||||
import { ProvisioningProfileStoreInfo } from '../../appstore/Credentials.types';
|
||||
|
||||
export function isDevPortalAdhocProfileValid(
|
||||
profileFromDevPortal: ProvisioningProfileStoreInfo | null,
|
||||
distCert: AppleDistributionCertificateFragment,
|
||||
expectedDevices: AppleDeviceFragmentWithAppleTeam[]
|
||||
): boolean {
|
||||
if (!profileFromDevPortal) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (profileFromDevPortal.status === 'Invalid' || profileFromDevPortal.certificates.length === 0) {
|
||||
Log.log('Provisioning Profile is invalid');
|
||||
return false;
|
||||
}
|
||||
|
||||
const currentDistCertId = profileFromDevPortal.certificates[0].id;
|
||||
if (
|
||||
distCert.developerPortalIdentifier &&
|
||||
distCert.developerPortalIdentifier !== currentDistCertId
|
||||
) {
|
||||
Log.log(
|
||||
`Provisioning Profile was generated for Distribution Certificate with ID "${currentDistCertId}", expected ID "${distCert.developerPortalIdentifier}"`
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
const profileDeviceUdids = (profileFromDevPortal.devices ?? []).map(({ udid }) => udid);
|
||||
const expectedDeviceUdids = expectedDevices.map(({ identifier }) => identifier);
|
||||
if (!doUDIDsMatch(profileDeviceUdids, expectedDeviceUdids)) {
|
||||
Log.log('Provisioning Profile was generated for another set of devices');
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
export function doUDIDsMatch(udidsA: string[], udidsB: string[]): boolean {
|
||||
return isEqual(new Set(udidsA), new Set(udidsB));
|
||||
}
|
||||
+175
-136
@@ -1,184 +1,223 @@
|
||||
import assert from 'assert';
|
||||
import chalk from 'chalk';
|
||||
import differenceBy from 'lodash/differenceBy';
|
||||
import isEqual from 'lodash/isEqual';
|
||||
import nullthrows from 'nullthrows';
|
||||
|
||||
import DeviceCreateAction, { RegistrationMethod } from '../../../../devices/actions/create/action';
|
||||
import {
|
||||
AppleDevice,
|
||||
AppleDeviceFragment,
|
||||
AppleProvisioningProfileFragment,
|
||||
AppleTeamFragment,
|
||||
IosAppBuildCredentialsFragment,
|
||||
IosDistributionType,
|
||||
} from '../../../../graphql/generated';
|
||||
import Log from '../../../../log';
|
||||
import { confirmAsync } from '../../../../prompts';
|
||||
import { confirmAsync, pressAnyKeyToContinueAsync } from '../../../../prompts';
|
||||
import { Context } from '../../../context';
|
||||
import { AppLookupParams } from '../../api/GraphqlClient';
|
||||
import { AppleProvisioningProfileMutationResult } from '../../api/graphql/mutations/AppleProvisioningProfileMutation';
|
||||
import { AppleDeviceFragmentWithAppleTeam } from '../../api/graphql/queries/AppleDeviceQuery';
|
||||
import { AppleProvisioningProfileQueryResult } from '../../api/graphql/queries/AppleProvisioningProfileQuery';
|
||||
import { ProvisioningProfileStoreInfo } from '../../appstore/Credentials.types';
|
||||
import { ProfileClass } from '../../appstore/provisioningProfile';
|
||||
import { AppleTeamMissingError, MissingCredentialsNonInteractiveError } from '../../errors';
|
||||
import { MissingCredentialsNonInteractiveError } from '../../errors';
|
||||
import { validateProvisioningProfileAsync } from '../../validators/validateProvisioningProfile';
|
||||
import { resolveAppleTeamIfAuthenticatedAsync } from './AppleTeamUtils';
|
||||
import { chooseDevices } from './DeviceUtils';
|
||||
import { doUDIDsMatch, isDevPortalAdhocProfileValid } from './ProvisioningProfileUtils';
|
||||
import { assignBuildCredentialsAsync, getBuildCredentialsAsync } from './BuildCredentialsUtils';
|
||||
import { chooseDevices, formatDeviceLabel } from './DeviceUtils';
|
||||
import { SetupDistributionCertificate } from './SetupDistributionCertificate';
|
||||
|
||||
export class SetupAdhocProvisioningProfile {
|
||||
constructor(private app: AppLookupParams) {}
|
||||
|
||||
async runAsync(ctx: Context): Promise<IosAppBuildCredentialsFragment> {
|
||||
if (ctx.nonInteractive) {
|
||||
try {
|
||||
return await this.runNonInteractiveAsync(ctx);
|
||||
} catch (err) {
|
||||
if (err instanceof AppleTeamMissingError) {
|
||||
throw new MissingCredentialsNonInteractiveError();
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
} else {
|
||||
return await this.runInteractiveAsync(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
private async runNonInteractiveAsync(ctx: Context): Promise<IosAppBuildCredentialsFragment> {
|
||||
// 1. Setup Distribution Certificate
|
||||
await new SetupDistributionCertificate(this.app, IosDistributionType.AdHoc).runAsync(ctx);
|
||||
|
||||
// 2. Fetch profile from EAS servers
|
||||
const currentProfile = await ctx.newIos.getProvisioningProfileAsync(
|
||||
this.app,
|
||||
IosDistributionType.AdHoc
|
||||
);
|
||||
|
||||
if (!currentProfile) {
|
||||
throw new MissingCredentialsNonInteractiveError();
|
||||
}
|
||||
|
||||
// TODO: implement validation
|
||||
Log.warn(
|
||||
'Provisioning Profile is not validated for non-interactive internal distribution builds.'
|
||||
);
|
||||
|
||||
// app credentials should exist here because the profile exists
|
||||
const appCredentials = nullthrows(
|
||||
await ctx.newIos.getIosAppCredentialsWithBuildCredentialsAsync(this.app, {
|
||||
iosDistributionType: IosDistributionType.AdHoc,
|
||||
})
|
||||
);
|
||||
return appCredentials.iosAppBuildCredentialsArray[0];
|
||||
}
|
||||
|
||||
private async runInteractiveAsync(ctx: Context): Promise<IosAppBuildCredentialsFragment> {
|
||||
// 0. Ensure the user is authenticated with Apple and resolve the Apple team object
|
||||
await ctx.appStore.ensureAuthenticatedAsync();
|
||||
const appleTeam = nullthrows(await resolveAppleTeamIfAuthenticatedAsync(ctx, this.app));
|
||||
|
||||
// 1. Fetch devices registered on EAS servers
|
||||
const registeredAppleDevices = await ctx.newIos.getDevicesForAppleTeamAsync(
|
||||
this.app,
|
||||
appleTeam
|
||||
);
|
||||
const registeredAppleDeviceIdentifiers = registeredAppleDevices.map(
|
||||
({ identifier }) => identifier
|
||||
);
|
||||
if (registeredAppleDeviceIdentifiers.length === 0) {
|
||||
throw new Error(`Run 'eas device:create' to register your devices first`);
|
||||
}
|
||||
|
||||
// 2. Setup Distribution Certificate
|
||||
const distCert = await new SetupDistributionCertificate(
|
||||
this.app,
|
||||
IosDistributionType.AdHoc
|
||||
).runAsync(ctx);
|
||||
|
||||
let profileFromExpoServersToUse:
|
||||
| AppleProvisioningProfileQueryResult
|
||||
| AppleProvisioningProfileMutationResult
|
||||
| null = await ctx.newIos.getProvisioningProfileAsync(this.app, IosDistributionType.AdHoc, {
|
||||
appleTeam,
|
||||
});
|
||||
const areBuildCredentialsSetup = await this.areBuildCredentialsSetupAsync(ctx);
|
||||
|
||||
// 4. Choose devices for internal distribution
|
||||
let chosenDevices: AppleDeviceFragmentWithAppleTeam[];
|
||||
if (profileFromExpoServersToUse) {
|
||||
const appleDeviceIdentifiersFromProfile = ((profileFromExpoServersToUse.appleDevices ??
|
||||
[]) as AppleDevice[]).map(({ identifier }) => identifier);
|
||||
|
||||
let shouldAskToChooseDevices = true;
|
||||
if (doUDIDsMatch(appleDeviceIdentifiersFromProfile, registeredAppleDeviceIdentifiers)) {
|
||||
shouldAskToChooseDevices = await confirmAsync({
|
||||
message: `All your registered devices are present in the Provisioning Profile. Would you like to exclude some devices?`,
|
||||
initial: false,
|
||||
});
|
||||
if (ctx.nonInteractive) {
|
||||
if (areBuildCredentialsSetup) {
|
||||
return nullthrows(await getBuildCredentialsAsync(ctx, this.app, IosDistributionType.AdHoc));
|
||||
} else {
|
||||
throw new MissingCredentialsNonInteractiveError(
|
||||
'Provisioning profile is not configured correctly. Please run this command again in interactive mode.'
|
||||
);
|
||||
}
|
||||
|
||||
chosenDevices = shouldAskToChooseDevices
|
||||
? await chooseDevices(registeredAppleDevices, appleDeviceIdentifiersFromProfile)
|
||||
: registeredAppleDevices;
|
||||
} else {
|
||||
chosenDevices = await chooseDevices(registeredAppleDevices);
|
||||
}
|
||||
|
||||
// 5. Try to find the profile on Apple Developer Portal
|
||||
const currentProfileFromDevPortal = await this.getProfileFromDevPortalAsync(ctx);
|
||||
|
||||
// 6. Validate the profile and possibly recreate it
|
||||
let profileToUse: ProvisioningProfileStoreInfo;
|
||||
let profileWasRecreated = false;
|
||||
if (isDevPortalAdhocProfileValid(currentProfileFromDevPortal, distCert, chosenDevices)) {
|
||||
profileToUse = nullthrows(currentProfileFromDevPortal);
|
||||
} else {
|
||||
const chosenDeviceUDIDs = chosenDevices.map(({ identifier }) => identifier);
|
||||
await ctx.appStore.createOrReuseAdhocProvisioningProfileAsync(
|
||||
chosenDeviceUDIDs,
|
||||
this.app.bundleIdentifier,
|
||||
distCert.serialNumber
|
||||
);
|
||||
profileToUse = nullthrows(await this.getProfileFromDevPortalAsync(ctx));
|
||||
profileWasRecreated = true;
|
||||
const currentBuildCredentials = await getBuildCredentialsAsync(
|
||||
ctx,
|
||||
this.app,
|
||||
IosDistributionType.AdHoc
|
||||
);
|
||||
if (areBuildCredentialsSetup) {
|
||||
const buildCredentials = nullthrows(currentBuildCredentials);
|
||||
if (await this.shouldGenerateNewProfileAsync(ctx, buildCredentials)) {
|
||||
return buildCredentials;
|
||||
}
|
||||
}
|
||||
|
||||
// 7. Send profile to www if new has been created
|
||||
// 1. Resolve Apple Team
|
||||
let appleTeam: AppleTeamFragment | null =
|
||||
distCert.appleTeam ?? currentBuildCredentials?.provisioningProfile?.appleTeam ?? null;
|
||||
if (!appleTeam) {
|
||||
await ctx.appStore.ensureAuthenticatedAsync();
|
||||
appleTeam = await resolveAppleTeamIfAuthenticatedAsync(ctx, this.app);
|
||||
}
|
||||
assert(appleTeam, 'Apple Team must be defined here');
|
||||
|
||||
// 2. Fetch devices registered on EAS servers
|
||||
let registeredAppleDevices = await ctx.newIos.getDevicesForAppleTeamAsync(this.app, appleTeam);
|
||||
if (registeredAppleDevices.length === 0) {
|
||||
const shouldRegisterDevices = await confirmAsync({
|
||||
message: `You don't have any registered devices yet. Would you like to register them now?`,
|
||||
initial: true,
|
||||
});
|
||||
|
||||
if (shouldRegisterDevices) {
|
||||
registeredAppleDevices = await this.registerDevicesAsync(ctx, appleTeam);
|
||||
} else {
|
||||
throw new Error(`Run 'eas device:create' to register your devices first`);
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Choose devices for internal distribution
|
||||
const provisionedDeviceIdentifiers = (
|
||||
currentBuildCredentials?.provisioningProfile?.appleDevices ?? []
|
||||
).map(i => i.identifier);
|
||||
const chosenDevices = await chooseDevices(registeredAppleDevices, provisionedDeviceIdentifiers);
|
||||
|
||||
// 4. Reuse or create the profile on Apple Developer Portal
|
||||
const provisioningProfileStoreInfo = await ctx.appStore.createOrReuseAdhocProvisioningProfileAsync(
|
||||
chosenDevices.map(({ identifier }) => identifier),
|
||||
this.app.bundleIdentifier,
|
||||
distCert.serialNumber
|
||||
);
|
||||
|
||||
// 5. Create or update the profile on servers
|
||||
const appleAppIdentifier = await ctx.newIos.createOrGetExistingAppleAppIdentifierAsync(
|
||||
this.app,
|
||||
appleTeam
|
||||
);
|
||||
if (profileFromExpoServersToUse) {
|
||||
if (profileWasRecreated) {
|
||||
profileFromExpoServersToUse = await ctx.newIos.updateProvisioningProfileAsync(
|
||||
profileFromExpoServersToUse.id,
|
||||
let appleProvisioningProfile: AppleProvisioningProfileFragment | null = null;
|
||||
if (currentBuildCredentials?.provisioningProfile) {
|
||||
if (
|
||||
currentBuildCredentials.provisioningProfile.developerPortalIdentifier !==
|
||||
provisioningProfileStoreInfo.provisioningProfileId
|
||||
) {
|
||||
await ctx.newIos.deleteProvisioningProfilesAsync([
|
||||
currentBuildCredentials.provisioningProfile.id,
|
||||
]);
|
||||
appleProvisioningProfile = await ctx.newIos.createProvisioningProfileAsync(
|
||||
this.app,
|
||||
appleAppIdentifier,
|
||||
{
|
||||
appleProvisioningProfile: profileToUse.provisioningProfile,
|
||||
developerPortalIdentifier: profileToUse.provisioningProfileId,
|
||||
appleProvisioningProfile: provisioningProfileStoreInfo.provisioningProfile,
|
||||
developerPortalIdentifier: provisioningProfileStoreInfo.provisioningProfileId,
|
||||
}
|
||||
);
|
||||
} else {
|
||||
appleProvisioningProfile = currentBuildCredentials.provisioningProfile;
|
||||
}
|
||||
} else {
|
||||
profileFromExpoServersToUse = await ctx.newIos.createProvisioningProfileAsync(
|
||||
appleProvisioningProfile = await ctx.newIos.createProvisioningProfileAsync(
|
||||
this.app,
|
||||
appleAppIdentifier,
|
||||
{
|
||||
appleProvisioningProfile: profileToUse.provisioningProfile,
|
||||
developerPortalIdentifier: profileToUse.provisioningProfileId,
|
||||
appleProvisioningProfile: provisioningProfileStoreInfo.provisioningProfile,
|
||||
developerPortalIdentifier: provisioningProfileStoreInfo.provisioningProfileId,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// 8. Create (or update) app build credentials
|
||||
return await ctx.newIos.createOrUpdateIosAppBuildCredentialsAsync(this.app, {
|
||||
appleTeam,
|
||||
appleAppIdentifierId: appleAppIdentifier.id,
|
||||
appleDistributionCertificateId: distCert.id,
|
||||
appleProvisioningProfileId: profileFromExpoServersToUse.id,
|
||||
iosDistributionType: IosDistributionType.AdHoc,
|
||||
});
|
||||
// 6. Create (or update) app build credentials
|
||||
assert(appleProvisioningProfile);
|
||||
return await assignBuildCredentialsAsync(
|
||||
ctx,
|
||||
this.app,
|
||||
IosDistributionType.AdHoc,
|
||||
distCert,
|
||||
appleProvisioningProfile,
|
||||
appleTeam
|
||||
);
|
||||
}
|
||||
|
||||
private async getProfileFromDevPortalAsync(
|
||||
ctx: Context
|
||||
): Promise<ProvisioningProfileStoreInfo | null> {
|
||||
const profilesFromDevPortal = await ctx.appStore.listProvisioningProfilesAsync(
|
||||
this.app.bundleIdentifier,
|
||||
ProfileClass.Adhoc
|
||||
private async areBuildCredentialsSetupAsync(ctx: Context): Promise<boolean> {
|
||||
const buildCredentials = await getBuildCredentialsAsync(
|
||||
ctx,
|
||||
this.app,
|
||||
IosDistributionType.AdHoc
|
||||
);
|
||||
return profilesFromDevPortal.length >= 1 ? profilesFromDevPortal[0] : null;
|
||||
return await validateProvisioningProfileAsync(ctx, this.app, buildCredentials);
|
||||
}
|
||||
|
||||
private async shouldGenerateNewProfileAsync(
|
||||
ctx: Context,
|
||||
buildCredentials: IosAppBuildCredentialsFragment
|
||||
): Promise<boolean> {
|
||||
const provisioningProfile = nullthrows(buildCredentials.provisioningProfile);
|
||||
|
||||
const appleTeam = nullthrows(provisioningProfile.appleTeam);
|
||||
const registeredAppleDevices = await ctx.newIos.getDevicesForAppleTeamAsync(
|
||||
this.app,
|
||||
appleTeam
|
||||
);
|
||||
|
||||
const provisionedDevices = provisioningProfile.appleDevices;
|
||||
|
||||
const allRegisteredDevicesAreProvisioned = doUDIDsMatch(
|
||||
registeredAppleDevices.map(({ identifier }) => identifier),
|
||||
provisionedDevices.map(({ identifier }) => identifier)
|
||||
);
|
||||
|
||||
if (allRegisteredDevicesAreProvisioned) {
|
||||
return await confirmAsync({
|
||||
message: `All your registered devices are present in the Provisioning Profile. Would you like to reuse it?`,
|
||||
initial: true,
|
||||
});
|
||||
} else {
|
||||
const missingDevices = differenceBy(registeredAppleDevices, provisionedDevices, 'identifier');
|
||||
Log.warn(`The provisioning profile is missing the following devices:`);
|
||||
for (const missingDevice of missingDevices) {
|
||||
Log.warn(`- ${formatDeviceLabel(missingDevice)}`);
|
||||
}
|
||||
return !(await confirmAsync({
|
||||
message: `Would you like to choose the devices to provision again?`,
|
||||
initial: true,
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
private async registerDevicesAsync(
|
||||
ctx: Context,
|
||||
appleTeam: AppleTeamFragment
|
||||
): Promise<AppleDeviceFragment[]> {
|
||||
const action = new DeviceCreateAction(this.app.account, appleTeam);
|
||||
const method = await action.runAsync();
|
||||
|
||||
while (true) {
|
||||
if (method !== RegistrationMethod.INPUT) {
|
||||
Log.newLine();
|
||||
Log.log(chalk.bold("Press any key if you've already finished device registration."));
|
||||
await pressAnyKeyToContinueAsync();
|
||||
}
|
||||
Log.newLine();
|
||||
|
||||
const devices = await ctx.newIos.getDevicesForAppleTeamAsync(this.app, appleTeam, {
|
||||
useCache: false,
|
||||
});
|
||||
if (devices.length === 0) {
|
||||
Log.warn('There are still no registered devices.');
|
||||
// if the user used the input method there should be some devices available
|
||||
if (method === RegistrationMethod.INPUT) {
|
||||
throw new Error('Input registration method has failed');
|
||||
}
|
||||
} else {
|
||||
return devices;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function doUDIDsMatch(udidsA: string[], udidsB: string[]): boolean {
|
||||
return isEqual(new Set(udidsA), new Set(udidsB));
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import {
|
||||
IosAppBuildCredentialsFragment,
|
||||
IosDistributionType,
|
||||
} from '../../../../graphql/generated';
|
||||
import Log from '../../../../log';
|
||||
import { confirmAsync } from '../../../../prompts';
|
||||
import { Context } from '../../../context';
|
||||
import { AppLookupParams } from '../../api/GraphqlClient';
|
||||
@@ -28,14 +27,7 @@ export class SetupProvisioningProfile {
|
||||
|
||||
async areBuildCredentialsSetupAsync(ctx: Context): Promise<boolean> {
|
||||
const buildCredentials = await getBuildCredentialsAsync(ctx, this.app, this.distributionType);
|
||||
if (!buildCredentials) {
|
||||
return false;
|
||||
}
|
||||
const { distributionCertificate, provisioningProfile } = buildCredentials;
|
||||
if (!distributionCertificate || !provisioningProfile) {
|
||||
return false;
|
||||
}
|
||||
return await this.isCurrentProfileValidAsync(ctx, provisioningProfile, distributionCertificate);
|
||||
return await validateProvisioningProfileAsync(ctx, this.app, buildCredentials);
|
||||
}
|
||||
|
||||
async assignNewAndDeleteOldProfileAsync(
|
||||
@@ -89,6 +81,11 @@ export class SetupProvisioningProfile {
|
||||
}
|
||||
|
||||
async runAsync(ctx: Context): Promise<IosAppBuildCredentialsFragment> {
|
||||
const distCert = await new SetupDistributionCertificate(
|
||||
this.app,
|
||||
this.distributionType
|
||||
).runAsync(ctx);
|
||||
|
||||
const areBuildCredentialsSetup = await this.areBuildCredentialsSetupAsync(ctx);
|
||||
if (areBuildCredentialsSetup) {
|
||||
return nullthrows(await getBuildCredentialsAsync(ctx, this.app, this.distributionType));
|
||||
@@ -99,11 +96,6 @@ export class SetupProvisioningProfile {
|
||||
);
|
||||
}
|
||||
|
||||
const distCert = await new SetupDistributionCertificate(
|
||||
this.app,
|
||||
this.distributionType
|
||||
).runAsync(ctx);
|
||||
|
||||
const currentProfile = await getProvisioningProfileAsync(ctx, this.app, this.distributionType);
|
||||
if (!currentProfile) {
|
||||
return await this.createAndAssignProfileAsync(ctx, distCert);
|
||||
@@ -140,37 +132,6 @@ export class SetupProvisioningProfile {
|
||||
return updatedProfile;
|
||||
}
|
||||
|
||||
private async isCurrentProfileValidAsync(
|
||||
ctx: Context,
|
||||
currentProfile: AppleProvisioningProfileFragment,
|
||||
currentCertificate: AppleDistributionCertificateFragment
|
||||
): Promise<boolean> {
|
||||
const { provisioningProfile, developerPortalIdentifier } = currentProfile;
|
||||
const { certificateP12, certificatePassword } = currentCertificate;
|
||||
if (!provisioningProfile || !certificateP12 || !certificatePassword) {
|
||||
return false;
|
||||
}
|
||||
const validationResult = await validateProvisioningProfileAsync(
|
||||
ctx,
|
||||
{
|
||||
provisioningProfile,
|
||||
...(developerPortalIdentifier
|
||||
? { provisioningProfileId: developerPortalIdentifier }
|
||||
: null),
|
||||
},
|
||||
{
|
||||
certP12: certificateP12,
|
||||
certPassword: certificatePassword,
|
||||
},
|
||||
this.app.bundleIdentifier
|
||||
);
|
||||
if (!validationResult.ok) {
|
||||
Log.warn(validationResult.error);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private getCurrentProfileStoreInfo(
|
||||
profiles: ProvisioningProfileStoreInfo[],
|
||||
currentProfile: AppleProvisioningProfileFragment
|
||||
|
||||
+5
-11
@@ -23,10 +23,7 @@ jest.mock('../../../validators/validateProvisioningProfile');
|
||||
|
||||
describe('SetupProvisioningProfile', () => {
|
||||
it('repairs existing Provisioning Profile with bad build credentials in Interactive Mode', async () => {
|
||||
(validateProvisioningProfileAsync as jest.Mock).mockImplementation(() => ({
|
||||
error: 'testing: everything is fine, ignore this',
|
||||
ok: false,
|
||||
}));
|
||||
(validateProvisioningProfileAsync as jest.Mock).mockImplementation(() => false);
|
||||
const ctx = createCtxMock({
|
||||
nonInteractive: false,
|
||||
appStore: {
|
||||
@@ -66,10 +63,7 @@ describe('SetupProvisioningProfile', () => {
|
||||
expect((ctx.newIos.deleteProvisioningProfilesAsync as any).mock.calls.length).toBe(0);
|
||||
});
|
||||
it('sets up a new Provisioning Profile with bad build credentials in Interactive Mode', async () => {
|
||||
(validateProvisioningProfileAsync as jest.Mock).mockImplementation(() => ({
|
||||
error: 'testing: everything is fine, ignore this',
|
||||
ok: false,
|
||||
}));
|
||||
(validateProvisioningProfileAsync as jest.Mock).mockImplementation(() => false);
|
||||
const ctx = createCtxMock({
|
||||
nonInteractive: false,
|
||||
appStore: {
|
||||
@@ -99,9 +93,7 @@ describe('SetupProvisioningProfile', () => {
|
||||
expect((ctx.newIos.deleteProvisioningProfilesAsync as any).mock.calls.length).toBe(1);
|
||||
});
|
||||
it('skips setting up a Provisioning Profile with prior build credentials configured properly in Interactive Mode', async () => {
|
||||
(validateProvisioningProfileAsync as jest.Mock).mockImplementation(() => ({
|
||||
ok: true,
|
||||
}));
|
||||
(validateProvisioningProfileAsync as jest.Mock).mockImplementation(() => true);
|
||||
const ctx = createCtxMock({
|
||||
nonInteractive: false,
|
||||
appStore: {
|
||||
@@ -131,6 +123,7 @@ describe('SetupProvisioningProfile', () => {
|
||||
expect((ctx.newIos.deleteProvisioningProfilesAsync as any).mock.calls.length).toBe(0);
|
||||
});
|
||||
it('sets up a Provisioning Profile with no prior build credentials configured in Interactive Mode', async () => {
|
||||
(validateProvisioningProfileAsync as jest.Mock).mockImplementation(() => false);
|
||||
const ctx = createCtxMock({
|
||||
nonInteractive: false,
|
||||
appStore: {
|
||||
@@ -156,6 +149,7 @@ describe('SetupProvisioningProfile', () => {
|
||||
expect((ctx.newIos.deleteProvisioningProfilesAsync as any).mock.calls.length).toBe(0);
|
||||
});
|
||||
it('errors in Non Interactive Mode', async () => {
|
||||
(validateProvisioningProfileAsync as jest.Mock).mockImplementation(() => false);
|
||||
const ctx = createCtxMock({
|
||||
nonInteractive: true,
|
||||
});
|
||||
|
||||
@@ -3,6 +3,7 @@ import nullthrows from 'nullthrows';
|
||||
import {
|
||||
AppFragment,
|
||||
AppleAppIdentifierFragment,
|
||||
AppleDeviceFragment,
|
||||
AppleDistributionCertificateFragment,
|
||||
AppleTeamFragment,
|
||||
CommonIosAppCredentialsFragment,
|
||||
@@ -26,10 +27,7 @@ import { IosAppBuildCredentialsMutation } from './graphql/mutations/IosAppBuildC
|
||||
import { IosAppCredentialsMutation } from './graphql/mutations/IosAppCredentialsMutation';
|
||||
import { AppQuery } from './graphql/queries/AppQuery';
|
||||
import { AppleAppIdentifierQuery } from './graphql/queries/AppleAppIdentifierQuery';
|
||||
import {
|
||||
AppleDeviceFragmentWithAppleTeam,
|
||||
AppleDeviceQuery,
|
||||
} from './graphql/queries/AppleDeviceQuery';
|
||||
import { AppleDeviceQuery } from './graphql/queries/AppleDeviceQuery';
|
||||
import { AppleDistributionCertificateQuery } from './graphql/queries/AppleDistributionCertificateQuery';
|
||||
import {
|
||||
AppleProvisioningProfileQuery,
|
||||
@@ -215,9 +213,12 @@ export async function createOrGetExistingAppleAppIdentifierAsync(
|
||||
|
||||
export async function getDevicesForAppleTeamAsync(
|
||||
{ account }: AppLookupParams,
|
||||
{ appleTeamIdentifier }: AppleTeamFragment
|
||||
): Promise<AppleDeviceFragmentWithAppleTeam[]> {
|
||||
return await AppleDeviceQuery.getAllByAppleTeamIdentifierAsync(account.id, appleTeamIdentifier);
|
||||
{ appleTeamIdentifier }: AppleTeamFragment,
|
||||
{ useCache = true }: { useCache?: boolean } = {}
|
||||
): Promise<AppleDeviceFragment[]> {
|
||||
return await AppleDeviceQuery.getAllByAppleTeamIdentifierAsync(account.id, appleTeamIdentifier, {
|
||||
useCache,
|
||||
});
|
||||
}
|
||||
|
||||
export async function createProvisioningProfileAsync(
|
||||
|
||||
@@ -34,7 +34,8 @@ export type AppleDevicesByIdentifierQueryResult = AppleDeviceQueryResult & {
|
||||
const AppleDeviceQuery = {
|
||||
async getAllByAppleTeamIdentifierAsync(
|
||||
accountId: string,
|
||||
appleTeamIdentifier: string
|
||||
appleTeamIdentifier: string,
|
||||
{ useCache = true }: { useCache?: boolean } = {}
|
||||
): Promise<AppleDeviceFragmentWithAppleTeam[]> {
|
||||
const data = await withErrorHandlingAsync(
|
||||
graphqlClient
|
||||
@@ -63,7 +64,10 @@ const AppleDeviceQuery = {
|
||||
accountId,
|
||||
appleTeamIdentifier,
|
||||
},
|
||||
{ additionalTypenames: ['AppleDevice'] }
|
||||
{
|
||||
additionalTypenames: ['AppleDevice'],
|
||||
requestPolicy: useCache ? 'cache-first' : 'network-only',
|
||||
}
|
||||
)
|
||||
.toPromise()
|
||||
);
|
||||
|
||||
@@ -1,127 +1,128 @@
|
||||
import { PlistArray, PlistObject } from '@expo/plist';
|
||||
import assert from 'assert';
|
||||
import crypto from 'crypto';
|
||||
import minimatch from 'minimatch';
|
||||
import nullthrows from 'nullthrows';
|
||||
|
||||
import { IosAppBuildCredentialsFragment, IosDistributionType } from '../../../graphql/generated';
|
||||
import Log from '../../../log';
|
||||
import { Context } from '../../context';
|
||||
import { DistributionCertificate, ProvisioningProfile } from '../appstore/Credentials.types';
|
||||
import { AppLookupParams } from '../api/GraphqlClient';
|
||||
import { ProfileClass } from '../appstore/provisioningProfile';
|
||||
import { getP12CertFingerprint } from '../utils/p12Certificate';
|
||||
import { parse as parseProvisioningProfile } from '../utils/provisioningProfile';
|
||||
|
||||
interface ValidationResult {
|
||||
error?: string;
|
||||
ok: boolean;
|
||||
}
|
||||
|
||||
export async function validateProvisioningProfileAsync(
|
||||
ctx: Context,
|
||||
profile: Pick<ProvisioningProfile, 'provisioningProfile' | 'provisioningProfileId'>,
|
||||
distCert: Pick<DistributionCertificate, 'certP12' | 'certPassword'>,
|
||||
bundleIdentifier: string
|
||||
): Promise<ValidationResult> {
|
||||
const resultWithoutApple = validateProvisioningProfileWithoutApple(
|
||||
profile,
|
||||
distCert,
|
||||
bundleIdentifier
|
||||
);
|
||||
app: AppLookupParams,
|
||||
buildCredentials: Partial<IosAppBuildCredentialsFragment> | null
|
||||
): Promise<boolean> {
|
||||
if (
|
||||
!buildCredentials ||
|
||||
!buildCredentials.distributionCertificate ||
|
||||
!buildCredentials.provisioningProfile
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// already failed, return early
|
||||
if (!resultWithoutApple.ok) {
|
||||
return resultWithoutApple;
|
||||
const resultWithoutApple = validateProvisioningProfileWithoutApple(app, buildCredentials);
|
||||
if (!resultWithoutApple) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ctx.appStore.authCtx) {
|
||||
Log.warn(
|
||||
"Skipping Provisioning Profile validation on Apple Servers because we aren't authenticated."
|
||||
);
|
||||
return resultWithoutApple;
|
||||
return true;
|
||||
}
|
||||
|
||||
return await validateProvisioningProfileWithAppleAsync(ctx, profile, bundleIdentifier);
|
||||
return await validateProvisioningProfileWithAppleAsync(ctx, app, buildCredentials);
|
||||
}
|
||||
|
||||
async function validateProvisioningProfileWithAppleAsync(
|
||||
ctx: Context,
|
||||
profile: Pick<ProvisioningProfile, 'provisioningProfile' | 'provisioningProfileId'>,
|
||||
bundleIdentifier: string
|
||||
): Promise<ValidationResult> {
|
||||
const profilesFromApple = await ctx.appStore.listProvisioningProfilesAsync(bundleIdentifier);
|
||||
|
||||
const configuredProfileFromApple = profilesFromApple.find(appleProfile =>
|
||||
profile.provisioningProfileId
|
||||
? appleProfile.provisioningProfileId === profile.provisioningProfileId
|
||||
: appleProfile.provisioningProfile === profile.provisioningProfile
|
||||
);
|
||||
if (!configuredProfileFromApple) {
|
||||
return {
|
||||
error: `Provisioning profile (id: ${profile.provisioningProfileId}) does not exist in Apple Dev Portal`,
|
||||
ok: false,
|
||||
};
|
||||
}
|
||||
if (configuredProfileFromApple.status !== 'ACTIVE') {
|
||||
return {
|
||||
error: `Provisioning profile (id: ${profile.provisioningProfileId}) is no longer valid`,
|
||||
ok: false,
|
||||
};
|
||||
}
|
||||
return { ok: true };
|
||||
}
|
||||
|
||||
export function validateProvisioningProfileWithoutApple(
|
||||
provisioningProfile: Pick<ProvisioningProfile, 'provisioningProfile' | 'provisioningProfileId'>,
|
||||
distCert: Pick<DistributionCertificate, 'certP12' | 'certPassword'>,
|
||||
bundleIdentifier: string
|
||||
): ValidationResult {
|
||||
function validateProvisioningProfileWithoutApple(
|
||||
app: AppLookupParams,
|
||||
{ provisioningProfile, distributionCertificate }: Partial<IosAppBuildCredentialsFragment>
|
||||
): boolean {
|
||||
try {
|
||||
const profilePlist = parseProvisioningProfile(provisioningProfile.provisioningProfile);
|
||||
const profilePlist = parseProvisioningProfile(
|
||||
nullthrows(provisioningProfile?.provisioningProfile)
|
||||
);
|
||||
|
||||
let distCertFingerprint: string;
|
||||
try {
|
||||
distCertFingerprint = getP12CertFingerprint(distCert.certP12, distCert.certPassword);
|
||||
distCertFingerprint = getP12CertFingerprint(
|
||||
nullthrows(distributionCertificate?.certificateP12),
|
||||
nullthrows(distributionCertificate?.certificatePassword)
|
||||
);
|
||||
} catch (e) {
|
||||
return {
|
||||
error: `Failed to calculate fingerprint for Distribution Certificate: ${e.toString()}`,
|
||||
ok: false,
|
||||
};
|
||||
Log.warn(`Failed to calculate fingerprint for Distribution Certificate: ${e.toString()}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
const devCertStatus = validateDeveloperCertificate(profilePlist, distCertFingerprint);
|
||||
if (!devCertStatus.ok) {
|
||||
return devCertStatus;
|
||||
if (!devCertStatus) {
|
||||
return false;
|
||||
}
|
||||
const bundleIdentifierStatus = validateBundleIdentifier(profilePlist, bundleIdentifier);
|
||||
if (!bundleIdentifierStatus.ok) {
|
||||
return bundleIdentifierStatus;
|
||||
|
||||
const bundleIdentifierStatus = validateBundleIdentifier(profilePlist, app.bundleIdentifier);
|
||||
if (!bundleIdentifierStatus) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const isExpired = new Date(profilePlist['ExpirationDate'] as string) <= new Date();
|
||||
if (isExpired) {
|
||||
return {
|
||||
error: 'Provisioning Profile has expired.',
|
||||
ok: false,
|
||||
};
|
||||
Log.warn('Provisioning Profile has expired.');
|
||||
return false;
|
||||
}
|
||||
} catch (error) {
|
||||
return {
|
||||
error: 'Provisioning Profile is malformed.',
|
||||
ok: false,
|
||||
};
|
||||
Log.warn('Provisioning Profile is malformed.');
|
||||
return false;
|
||||
}
|
||||
return {
|
||||
ok: true,
|
||||
};
|
||||
return true;
|
||||
}
|
||||
|
||||
async function validateProvisioningProfileWithAppleAsync(
|
||||
ctx: Context,
|
||||
app: AppLookupParams,
|
||||
buildCredentials: Partial<IosAppBuildCredentialsFragment>
|
||||
): Promise<boolean> {
|
||||
assert(buildCredentials.provisioningProfile, 'Provisioning Profile must be defined');
|
||||
const { developerPortalIdentifier, provisioningProfile } = buildCredentials.provisioningProfile;
|
||||
|
||||
const profilesFromApple = await ctx.appStore.listProvisioningProfilesAsync(
|
||||
app.bundleIdentifier,
|
||||
buildCredentials.iosDistributionType === IosDistributionType.AdHoc
|
||||
? ProfileClass.Adhoc
|
||||
: ProfileClass.General
|
||||
);
|
||||
|
||||
const configuredProfileFromApple = profilesFromApple.find(appleProfile =>
|
||||
developerPortalIdentifier
|
||||
? appleProfile.provisioningProfileId === developerPortalIdentifier
|
||||
: appleProfile.provisioningProfile === provisioningProfile
|
||||
);
|
||||
if (!configuredProfileFromApple) {
|
||||
Log.warn(
|
||||
`Provisioning profile (id: ${developerPortalIdentifier}) does not exist in Apple Developer Portal`
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (configuredProfileFromApple.status !== 'ACTIVE') {
|
||||
Log.warn(`Provisioning profile (id: ${developerPortalIdentifier}) is no longer valid`);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function validateDeveloperCertificate(
|
||||
plistData: PlistObject,
|
||||
distCertFingerprint: string
|
||||
): ValidationResult {
|
||||
): boolean {
|
||||
const devCertBase64 = (plistData?.DeveloperCertificates as PlistArray)?.[0] as string;
|
||||
if (!devCertBase64) {
|
||||
return {
|
||||
error: 'Missing certificate fingerprint in provisioning profile.',
|
||||
ok: false,
|
||||
};
|
||||
Log.warn('Missing certificate fingerprint in provisioning profile.');
|
||||
return false;
|
||||
}
|
||||
const devCertBuffer = Buffer.from(devCertBase64, 'base64');
|
||||
const devCertFingerprint = crypto
|
||||
@@ -131,40 +132,34 @@ function validateDeveloperCertificate(
|
||||
.toUpperCase();
|
||||
|
||||
if (devCertFingerprint !== distCertFingerprint) {
|
||||
return {
|
||||
error: 'Provisioning profile is not associated with uploaded Distribution Certificate.',
|
||||
ok: false,
|
||||
};
|
||||
Log.warn('Provisioning profile is not associated with uploaded Distribution Certificate.');
|
||||
return false;
|
||||
}
|
||||
return { ok: true };
|
||||
return true;
|
||||
}
|
||||
|
||||
function validateBundleIdentifier(
|
||||
plistData: PlistObject,
|
||||
expectedBundleIdentifier: string
|
||||
): ValidationResult {
|
||||
): boolean {
|
||||
const actualApplicationIdentifier = (plistData.Entitlements as PlistObject)?.[
|
||||
'application-identifier'
|
||||
] as string;
|
||||
if (!actualApplicationIdentifier) {
|
||||
return {
|
||||
error: 'Missing application-identifier in provisioning profile entitlements',
|
||||
ok: false,
|
||||
};
|
||||
Log.warn('Missing application-identifier in provisioning profile entitlements');
|
||||
return false;
|
||||
}
|
||||
const actualBundleIdentifier = /\.(.+)/.exec(actualApplicationIdentifier)?.[1] as string;
|
||||
if (!actualBundleIdentifier) {
|
||||
return {
|
||||
error: 'Malformed application-identifier field in provisioning profile',
|
||||
ok: false,
|
||||
};
|
||||
Log.warn('Malformed application-identifier field in provisioning profile');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!minimatch(expectedBundleIdentifier, actualBundleIdentifier)) {
|
||||
return {
|
||||
error: `Wrong bundleIdentifier found in provisioning profile; expected: ${expectedBundleIdentifier}, found (in provisioning profile): ${actualBundleIdentifier}`,
|
||||
ok: false,
|
||||
};
|
||||
Log.warn(
|
||||
`Wrong bundleIdentifier found in provisioning profile; expected: ${expectedBundleIdentifier}, found (in provisioning profile): ${actualBundleIdentifier}`
|
||||
);
|
||||
return false;
|
||||
}
|
||||
return { ok: true };
|
||||
return true;
|
||||
}
|
||||
@@ -79,9 +79,6 @@ export class ManageIosBeta implements Action {
|
||||
} catch (err) {
|
||||
Log.error(err);
|
||||
await manager.runActionAsync(new PressAnyKeyToContinue());
|
||||
} finally {
|
||||
// TODO remove finally block before committing!
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ export default class DeviceCreateAction {
|
||||
private appleTeam: Pick<AppleTeam, 'appleTeamIdentifier' | 'appleTeamName' | 'id'>
|
||||
) {}
|
||||
|
||||
public async runAsync(): Promise<void> {
|
||||
public async runAsync(): Promise<RegistrationMethod> {
|
||||
const method = await this.askForRegistrationMethodAsync();
|
||||
if (method === RegistrationMethod.WEBSITE) {
|
||||
await runRegistrationUrlMethodAsync(this.account.id, this.appleTeam);
|
||||
@@ -29,6 +29,7 @@ export default class DeviceCreateAction {
|
||||
Log.log('Bye!');
|
||||
process.exit(0);
|
||||
}
|
||||
return method;
|
||||
}
|
||||
|
||||
private async askForRegistrationMethodAsync(): Promise<RegistrationMethod> {
|
||||
|
||||
@@ -2386,9 +2386,16 @@ export type AndroidManagedJobInput = {
|
||||
secrets?: Maybe<AndroidJobSecretsInput>;
|
||||
builderEnvironment?: Maybe<AndroidBuilderEnvironmentInput>;
|
||||
cache?: Maybe<BuildCacheInput>;
|
||||
buildType?: Maybe<AndroidManagedBuildType>;
|
||||
username?: Maybe<Scalars['String']>;
|
||||
};
|
||||
|
||||
export enum AndroidManagedBuildType {
|
||||
Apk = 'APK',
|
||||
AppBundle = 'APP_BUNDLE',
|
||||
DevelopmentClient = 'DEVELOPMENT_CLIENT'
|
||||
}
|
||||
|
||||
export type IosGenericJobInput = {
|
||||
projectArchive: ProjectArchiveSourceInput;
|
||||
projectRootDirectory: Scalars['String'];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@expo/eas-json",
|
||||
"description": "A library for interacting with the eas.json",
|
||||
"version": "0.10.0",
|
||||
"version": "0.11.0",
|
||||
"author": "Expo <[email protected]>",
|
||||
"bugs": "https://github.com/expo/eas-cli/issues",
|
||||
"dependencies": {
|
||||
|
||||
@@ -3,7 +3,6 @@ import { Android, Cache, Ios, Workflow } from '@expo/eas-build-job';
|
||||
export enum CredentialsSource {
|
||||
LOCAL = 'local',
|
||||
REMOTE = 'remote',
|
||||
AUTO = 'auto',
|
||||
}
|
||||
|
||||
export type AndroidDistributionType = 'store' | 'internal';
|
||||
|
||||
@@ -40,7 +40,7 @@ const CacheSchema = Joi.object({
|
||||
|
||||
const AndroidGenericSchema = Joi.object({
|
||||
workflow: Joi.string().valid('generic').required(),
|
||||
credentialsSource: Joi.string().valid('local', 'remote', 'auto').default('auto'),
|
||||
credentialsSource: Joi.string().valid('local', 'remote').default('remote'),
|
||||
gradleCommand: Joi.alternatives().conditional('distribution', {
|
||||
is: 'internal',
|
||||
then: Joi.string().default(':app:assembleRelease'),
|
||||
@@ -55,7 +55,7 @@ const AndroidGenericSchema = Joi.object({
|
||||
|
||||
const AndroidManagedSchema = Joi.object({
|
||||
workflow: Joi.string().valid('managed').required(),
|
||||
credentialsSource: Joi.string().valid('local', 'remote', 'auto').default('auto'),
|
||||
credentialsSource: Joi.string().valid('local', 'remote').default('remote'),
|
||||
releaseChannel: Joi.string(),
|
||||
buildType: Joi.alternatives().conditional('distribution', {
|
||||
is: 'internal',
|
||||
@@ -68,7 +68,7 @@ const AndroidManagedSchema = Joi.object({
|
||||
|
||||
const IosGenericSchema = Joi.object({
|
||||
workflow: Joi.string().valid('generic').required(),
|
||||
credentialsSource: Joi.string().valid('local', 'remote', 'auto').default('auto'),
|
||||
credentialsSource: Joi.string().valid('local', 'remote').default('remote'),
|
||||
scheme: Joi.string(),
|
||||
schemeBuildConfiguration: Joi.string().valid('Debug', 'Release', 'Auto').default('Release'),
|
||||
releaseChannel: Joi.string(),
|
||||
@@ -83,7 +83,7 @@ const IosGenericSchema = Joi.object({
|
||||
|
||||
const IosManagedSchema = Joi.object({
|
||||
workflow: Joi.string().valid('managed').required(),
|
||||
credentialsSource: Joi.string().valid('local', 'remote', 'auto').default('auto'),
|
||||
credentialsSource: Joi.string().valid('local', 'remote').default('remote'),
|
||||
buildType: Joi.string().valid('release', 'development-client').default('release'),
|
||||
releaseChannel: Joi.string(),
|
||||
distribution: Joi.string().valid('store', 'internal', 'simulator').default('store'),
|
||||
|
||||
@@ -26,7 +26,7 @@ test('minimal valid android eas.json', async () => {
|
||||
android: {
|
||||
workflow: 'generic',
|
||||
distribution: 'store',
|
||||
credentialsSource: 'auto',
|
||||
credentialsSource: 'remote',
|
||||
env: {},
|
||||
withoutCredentials: false,
|
||||
cache: { disabled: false, cacheDefaultPaths: true, customPaths: [] },
|
||||
@@ -50,7 +50,7 @@ test('minimal valid ios eas.json', async () => {
|
||||
expect({
|
||||
builds: {
|
||||
ios: {
|
||||
credentialsSource: 'auto',
|
||||
credentialsSource: 'remote',
|
||||
distribution: 'store',
|
||||
workflow: 'generic',
|
||||
autoIncrement: false,
|
||||
@@ -82,7 +82,7 @@ test('minimal valid eas.json for both platforms', async () => {
|
||||
android: {
|
||||
workflow: 'generic',
|
||||
distribution: 'store',
|
||||
credentialsSource: 'auto',
|
||||
credentialsSource: 'remote',
|
||||
env: {},
|
||||
withoutCredentials: false,
|
||||
cache: { disabled: false, cacheDefaultPaths: true, customPaths: [] },
|
||||
@@ -91,7 +91,7 @@ test('minimal valid eas.json for both platforms', async () => {
|
||||
ios: {
|
||||
workflow: 'generic',
|
||||
distribution: 'store',
|
||||
credentialsSource: 'auto',
|
||||
credentialsSource: 'remote',
|
||||
autoIncrement: false,
|
||||
env: {},
|
||||
cache: { disabled: false, cacheDefaultPaths: true, customPaths: [] },
|
||||
@@ -121,7 +121,7 @@ test('valid eas.json with both platform, but reading only android', async () =>
|
||||
android: {
|
||||
workflow: 'generic',
|
||||
distribution: 'store',
|
||||
credentialsSource: 'auto',
|
||||
credentialsSource: 'remote',
|
||||
env: {},
|
||||
withoutCredentials: false,
|
||||
cache: { disabled: false, cacheDefaultPaths: true, customPaths: [] },
|
||||
@@ -153,7 +153,7 @@ test('valid eas.json for development client builds', async () => {
|
||||
expect({
|
||||
builds: {
|
||||
android: {
|
||||
credentialsSource: 'auto',
|
||||
credentialsSource: 'remote',
|
||||
workflow: 'managed',
|
||||
distribution: 'store',
|
||||
env: {},
|
||||
@@ -162,7 +162,7 @@ test('valid eas.json for development client builds', async () => {
|
||||
buildType: 'development-client',
|
||||
},
|
||||
ios: {
|
||||
credentialsSource: 'auto',
|
||||
credentialsSource: 'remote',
|
||||
workflow: 'managed',
|
||||
distribution: 'store',
|
||||
autoIncrement: false,
|
||||
@@ -194,7 +194,7 @@ test('valid generic profile for internal distribution on Android', async () => {
|
||||
android: {
|
||||
workflow: 'generic',
|
||||
distribution: 'internal',
|
||||
credentialsSource: 'auto',
|
||||
credentialsSource: 'remote',
|
||||
gradleCommand: ':app:assembleRelease',
|
||||
env: {},
|
||||
withoutCredentials: false,
|
||||
@@ -225,7 +225,7 @@ test('valid managed profile for internal distribution on Android', async () => {
|
||||
workflow: 'managed',
|
||||
buildType: 'apk',
|
||||
distribution: 'internal',
|
||||
credentialsSource: 'auto',
|
||||
credentialsSource: 'remote',
|
||||
env: {},
|
||||
cache: { disabled: false, cacheDefaultPaths: true, customPaths: [] },
|
||||
image: 'default',
|
||||
|
||||
Reference in new issue
Block a user