-
Notifications
You must be signed in to change notification settings - Fork 478
[expo-cli] use Submission Service for Android uploads #2069
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2069 +/- ##
=======================================
Coverage 36.01% 36.01%
=======================================
Files 148 148
Lines 6937 6937
Branches 1604 1604
=======================================
Hits 2498 2498
Misses 3249 3249
Partials 1190 1190 |
546c1eb
to
b445e95
Compare
packages/expo-cli/src/commands/upload/submission-service/ArchiveSource.ts
Outdated
Show resolved
Hide resolved
packages/expo-cli/src/commands/upload/submission-service/android/AndroidSubmitter.ts
Outdated
Show resolved
Hide resolved
b445e95
to
b7fb87e
Compare
message: 'What would you like to submit?', | ||
choices: [ | ||
{ name: 'I have a url to the app archive', value: ArchiveSourceType.url }, | ||
{ | ||
name: "I'd like to upload the app archive from my computer", | ||
value: ArchiveSourceType.path, | ||
}, | ||
{ | ||
name: 'The lastest build from Expo Servers', | ||
value: ArchiveSourceType.latest, | ||
}, | ||
{ | ||
name: 'A build identified by a build id', | ||
value: ArchiveSourceType.buildId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestions for better/more meaningful messages are welcome :)
async function askForArchiveUrlAsync(): Promise<string> { | ||
const { url } = await prompt({ | ||
name: 'url', | ||
message: 'URL:', | ||
type: 'input', | ||
validate: (url: string): string | boolean => | ||
validateUrl(url) || `${url} does not conform to HTTP format`, | ||
}); | ||
return url; | ||
} | ||
|
||
async function askForArchivePathAsync(): Promise<string> { | ||
const { path } = await prompt({ | ||
name: 'path', | ||
message: 'Path to the app archive file:', | ||
type: 'input', | ||
validate: async (path: string): Promise<boolean | string> => { | ||
if (!(await existingFile(path, false))) { | ||
return `File ${path} doesn't exist.`; | ||
} else { | ||
return true; | ||
} | ||
}, | ||
}); | ||
return path; | ||
} | ||
|
||
async function askForBuildIdAsync(): Promise<string> { | ||
const { id } = await prompt({ | ||
name: 'id', | ||
message: 'Build ID:', | ||
type: 'input', | ||
validate: (val: string): boolean => val !== '', | ||
}); | ||
return id; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
67f4759
to
23da17e
Compare
21326f2
to
da89741
Compare
packages/expo-cli/src/commands/upload/submission-service/archive-source/ArchiveFileSource.ts
Outdated
Show resolved
Hide resolved
packages/expo-cli/src/commands/upload/submission-service/android/ServiceAccountSource.ts
Show resolved
Hide resolved
packages/expo-cli/src/commands/upload/submission-service/android/AndroidSubmitter.ts
Outdated
Show resolved
Hide resolved
1 | ||
); | ||
if (builds.length === 0) { | ||
log.error("Couldn't find any builds for this project."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should be more clear about what this means and follow guidelines as mentioned in #2165 (probably use bold text)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this command won't exit if this log is printed. See the line below - a prompt will appear.
However, I'll try to make this message a bit more clear.
packages/expo-cli/src/commands/upload/submission-service/android/ServiceAccountSource.ts
Show resolved
Hide resolved
packages/expo-cli/src/commands/upload/submission-service/archive-source/ArchiveFileSource.ts
Outdated
Show resolved
Hide resolved
name: 'url', | ||
message: 'URL:', | ||
type: 'input', | ||
validate: (url: string): string | boolean => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can make the default value here something like https://path.to/your/archive.aab
and when we validate we just ensure that they didn't give us that exact value.
like: "That was just an example URL, meant to show you the format that we expect for the response."
packages/expo-cli/src/commands/upload/submission-service/archive-source/ArchiveFileSource.ts
Show resolved
Hide resolved
packages/expo-cli/src/commands/upload/submission-service/utils/errors.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a few feedback points that i hope will be helpful. i also ran the command manually a few more times and everything worked very well!
if (process.platform !== 'darwin') { | ||
log.error('Unsupported platform! This feature works on macOS only.'); | ||
if (targetPlatform === 'android') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌 this is great that we're letting users know about the flag contextually when attempting to run an upload from an unsupported platform
packages/expo-cli/src/commands/upload/submission-service/__mocks__/SubmissionService.ts
Show resolved
Hide resolved
Co-authored-by: Brent Vatne <brentvatne@gmail.com>
…ve-source/ArchiveFileSource.ts Co-authored-by: Brent Vatne <brentvatne@gmail.com>
ffce65b
to
b8b9056
Compare
} = this.submissionConfig; | ||
|
||
// TODO: check if `fastlane supply` works on linux | ||
const travelingFastlane = require(`@expo/traveling-fastlane-${os.platform()}`)(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For windows we should use @expo/traveling-fastlane-linux
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also some better error message could be useful here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed that. Regarding the error message - there is already a meaningful error message - https://github.com/expo/expo-cli/pull/2069/files#diff-911f5cceaa622faf6d5d53c7b83e5d3dR128 Generally, this code will never be executed on a different platform than macOS (yet).
@@ -0,0 +1,41 @@ | |||
import { AndroidSubmissionConfig } from './android/AndroidSubmissionConfig'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we use a naming convention like that anywhere else?
SubmissionService.types.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8477c27
to
8992cdb
Compare
This PR integrates
expo-cli
with Submission Service. Submission Service enables users to perform app submissions from Expo Servers. However, only Android submissions are available at the moment. The iOS part will be added soon.The command for submitting apps stays the same -
expo upload:android
. By default, this command will try to runfastlane
on the user's machine - this is expected behavior. Some users might want to submit their apps the old way - without using Submission Service.In order to use Submission Service, one needs to pass the
--use-submission-service
flag.This PR also adds more features to
expo upload:android
:--use-submission-service
)--use-submission-service
, the submission fails and we've managed to detect what went wrong - we're printing a link to an expo.fyi page with the solution to that problem--url
parameter - for specifying the archive's url--latest
(the last build from Expo servers),--id
(a build identified by a build id)--type [apk|aab]
parameter - if the archive url/path doesn't contain the filename extension then it's possible to specify the archive type--release-status [completed|draft|halted|inProgress]
parameter - to specify the release status of the app in Google Play Store--verbose
flag (only for Submission Service) - by default, we don't print logs from Submission Service; this flag enables the user to show them anywayNext steps:
www
. We don't want to turn this on for all users at once. This will enable us to ultimately get rid of the--use-submission-service
flag - we'll have an opposite one ---offline
(or similar) for submitting apps from the user's machine.expo-cli
.To do before merging:
To do after merging: