refactor(shorebird_cli): make shorebird patch default to production (#1363)

This commit is contained in:
Felix Angelov
2023-10-04 17:54:37 -05:00
committed by GitHub
parent d76d8e30e1
commit 76e26819e4
4 changed files with 18 additions and 18 deletions
@@ -63,9 +63,9 @@ class PatchAndroidCommand extends ShorebirdCommand
help: 'Validate but do not upload the patch.',
)
..addFlag(
'prod',
'staging',
negatable: false,
help: 'Whether to publish the patch to production',
help: 'Whether to publish the patch to the staging environment.',
);
}
@@ -94,7 +94,7 @@ class PatchAndroidCommand extends ShorebirdCommand
final force = results['force'] == true;
final dryRun = results['dry-run'] == true;
final isProd = results['prod'] == true;
final isStaging = results['staging'] == true;
if (force && dryRun) {
logger.err('Cannot use both --force and --dry-run.');
@@ -287,10 +287,10 @@ Current Flutter Revision: $originalFlutterRevision
if (flavor != null) '🍧 Flavor: ${lightCyan.wrap(flavor)}',
'📦 Release Version: ${lightCyan.wrap(releaseVersion)}',
'''🕹️ Platform: ${lightCyan.wrap(platform.name)} ${lightCyan.wrap('[${archMetadata.join(', ')}]')}''',
if (isProd)
'🟢 Track: ${lightCyan.wrap('Production')}'
if (isStaging)
'🟠 Track: ${lightCyan.wrap('Staging')}'
else
'🟠 Track: ${lightCyan.wrap('Staging')}',
'🟢 Track: ${lightCyan.wrap('Production')}',
];
logger.info(
@@ -316,7 +316,7 @@ ${summary.join('\n')}
appId: appId,
releaseId: release.id,
platform: platform,
track: isProd ? DeploymentTrack.production : DeploymentTrack.staging,
track: isStaging ? DeploymentTrack.staging : DeploymentTrack.production,
patchArtifactBundles: patchArtifactBundles,
);
@@ -61,9 +61,9 @@ class PatchIosCommand extends ShorebirdCommand
help: 'Validate but do not upload the patch.',
)
..addFlag(
'prod',
'staging',
negatable: false,
help: 'Whether to publish the patch to production',
help: 'Whether to publish the patch to the staging environment.',
);
}
@@ -94,7 +94,7 @@ class PatchIosCommand extends ShorebirdCommand
final force = results['force'] == true;
final dryRun = results['dry-run'] == true;
final isProd = results['prod'] == true;
final isStaging = results['staging'] == true;
if (force && dryRun) {
logger.err('Cannot use both --force and --dry-run.');
@@ -219,10 +219,10 @@ Current Flutter Revision: $originalFlutterRevision
if (flavor != null) '🍧 Flavor: ${lightCyan.wrap(flavor)}',
'📦 Release Version: ${lightCyan.wrap(releaseVersion)}',
'''🕹️ Platform: ${lightCyan.wrap(releasePlatform.name)} ${lightCyan.wrap('[$arch (${formatBytes(aotFileSize)})]')}''',
if (isProd)
'🟢 Track: ${lightCyan.wrap('Production')}'
if (isStaging)
'🟠 Track: ${lightCyan.wrap('Staging')}'
else
'🟠 Track: ${lightCyan.wrap('Staging')}',
'🟢 Track: ${lightCyan.wrap('Production')}',
];
logger.info(
@@ -248,7 +248,7 @@ ${summary.join('\n')}
appId: appId,
releaseId: release.id,
platform: releasePlatform,
track: isProd ? DeploymentTrack.production : DeploymentTrack.staging,
track: isStaging ? DeploymentTrack.staging : DeploymentTrack.production,
patchArtifactBundles: {
Arch.arm64: PatchArtifactBundle(
arch: arch,
@@ -267,7 +267,7 @@ flutter:
).thenReturn(false);
when(() => argResults.rest).thenReturn([]);
when(() => argResults['arch']).thenReturn(arch);
when(() => argResults['prod']).thenReturn(true);
when(() => argResults['staging']).thenReturn(false);
when(() => argResults['dry-run']).thenReturn(false);
when(() => argResults['force']).thenReturn(false);
when(() => argResults['release-version']).thenReturn(release.version);
@@ -827,7 +827,7 @@ Please re-run the release command for this version or create a new release.'''),
});
test('succeeds when patch is successful (staging)', () async {
when(() => argResults['prod']).thenReturn(false);
when(() => argResults['staging']).thenReturn(true);
final tempDir = setUpTempDir();
setUpTempArtifacts(tempDir);
final exitCode = await IOOverrides.runZoned(
@@ -256,7 +256,7 @@ flutter:
when(() => argResults['force']).thenReturn(false);
when(() => argResults['release-version']).thenReturn(release.version);
when(() => argResults['codesign']).thenReturn(true);
when(() => argResults['prod']).thenReturn(true);
when(() => argResults['staging']).thenReturn(false);
when(() => argResults.rest).thenReturn([]);
when(() => auth.isAuthenticated).thenReturn(true);
when(() => auth.client).thenReturn(httpClient);
@@ -890,7 +890,7 @@ Please re-run the release command for this version or create a new release.'''),
});
test('succeeds when patch is successful (staging)', () async {
when(() => argResults['prod']).thenReturn(false);
when(() => argResults['staging']).thenReturn(true);
final tempDir = setUpTempDir();
setUpTempArtifacts(tempDir);
final exitCode = await IOOverrides.runZoned(