1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-10 23:08:59 +00:00

Exit the sample index deployment CI script if a sub-process fails (#847)

This commit is contained in:
John Ryan
2021-07-09 14:58:15 -07:00
committed by GitHub
parent 054360e2a4
commit 1403e67144

View File

@@ -16,8 +16,8 @@ main() async {
];
print('Building the sample index...');
await run('samples_index', 'pub', ['get']);
await run('samples_index', 'pub', ['run', 'grinder', 'deploy']);
await _run('samples_index', 'pub', ['get']);
await _run('samples_index', 'pub', ['run', 'grinder', 'deploy']);
// Create the directory each Flutter Web sample lives in
Directory(p.join(Directory.current.path, 'samples_index', 'public', 'web'))
@@ -36,8 +36,17 @@ main() async {
'public', 'web', directoryName);
// Build the sample and copy the files
await run(directory, 'flutter', ['pub', 'get']);
await run(directory, 'flutter', ['build', 'web']);
await run(directory, 'mv', [sourceBuildDir, targetDirectory]);
await _run(directory, 'flutter', ['pub', 'get']);
await _run(directory, 'flutter', ['build', 'web']);
await _run(directory, 'mv', [sourceBuildDir, targetDirectory]);
}
}
// Invokes run() and exits if the sub-process failed.
Future<void> _run(
String workingDir, String commandName, List<String> args) async {
var success = await run(workingDir, commandName, args);
if (!success) {
exit(1);
}
}