feat: adding message with link to the release when releasing an existing release (#1891)

Co-authored-by: Felix Angelov <felix@shorebird.dev>
This commit is contained in:
Erick
2024-04-15 16:58:10 -03:00
committed by GitHub
parent b40336be85
commit 71d67df76c
5 changed files with 64 additions and 16 deletions
@@ -15,6 +15,7 @@ import 'package:shorebird_cli/src/deployment_track.dart';
import 'package:shorebird_cli/src/logger.dart';
import 'package:shorebird_cli/src/platform/platform.dart';
import 'package:shorebird_cli/src/shorebird_env.dart';
import 'package:shorebird_cli/src/shorebird_web_console.dart';
import 'package:shorebird_cli/src/third_party/flutter_tools/lib/flutter_tools.dart';
import 'package:shorebird_code_push_client/shorebird_code_push_client.dart';
@@ -159,10 +160,16 @@ This app may not exist or you may not have permission to view it.''',
required ReleasePlatform platform,
}) {
if (release.platformStatuses[platform] == ReleaseStatus.active) {
final uri = ShorebirdWebConsole.appReleaseUri(
release.appId,
release.id,
);
logger.err(
'''
It looks like you have an existing ${platform.name} release for version ${lightCyan.wrap(release.version)}.
Please bump your version number and try again.''',
Please bump your version number and try again.
You can manage this release in the ${link(uri: uri, message: 'Shorebird Console')}''',
);
exit(ExitCode.software.code);
}
@@ -0,0 +1,14 @@
class ShorebirdWebConsole {
static Uri uri(String path) {
return Uri.parse('https://console.shorebird.dev/$path');
}
static Uri appReleaseUri(
String appId,
int releaseId,
) {
return ShorebirdWebConsole.uri(
'apps/$appId/releases/$releaseId',
);
}
}
+14 -14
View File
@@ -29,10 +29,10 @@ packages:
dependency: "direct main"
description:
name: args
sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596
sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a"
url: "https://pub.dev"
source: hosted
version: "2.4.2"
version: "2.5.0"
asn1lib:
dependency: transitive
description:
@@ -493,10 +493,10 @@ packages:
dependency: transitive
description:
name: pointycastle
sha256: "43ac87de6e10afabc85c445745a7b799e04de84cebaa4fd7bf55a5e1e9604d29"
sha256: "70fe966348fe08c34bf929582f1d8247d9d9408130723206472b4687227e4333"
url: "https://pub.dev"
source: hosted
version: "3.7.4"
version: "3.8.0"
pool:
dependency: transitive
description:
@@ -698,26 +698,26 @@ packages:
dependency: "direct dev"
description:
name: test
sha256: "7ee446762c2c50b3bd4ea96fe13ffac69919352bd3b4b17bac3f3465edc58073"
sha256: d87214d19fb311997d8128ec501a980f77cb240ac4e7e219accf452813ff473c
url: "https://pub.dev"
source: hosted
version: "1.25.2"
version: "1.25.3"
test_api:
dependency: transitive
description:
name: test_api
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
sha256: "2419f20b0c8677b2d67c8ac4d1ac7372d862dc6c460cdbb052b40155408cd794"
url: "https://pub.dev"
source: hosted
version: "0.7.0"
version: "0.7.1"
test_core:
dependency: transitive
description:
name: test_core
sha256: "2bc4b4ecddd75309300d8096f781c0e3280ca1ef85beda558d33fcbedc2eead4"
sha256: "2236f70be1e5ab405c675e88c36935a87dad9e05a506b57dd5c0f617f5aebcb2"
url: "https://pub.dev"
source: hosted
version: "0.6.0"
version: "0.6.1"
timing:
dependency: transitive
description:
@@ -746,10 +746,10 @@ packages:
dependency: "direct main"
description:
name: uuid
sha256: cd210a09f7c18cbe5a02511718e0334de6559871052c90a90c0cca46a4aa81c8
sha256: "814e9e88f21a176ae1359149021870e87f7cddaf633ab678a5d2b0bff7fd1ba8"
url: "https://pub.dev"
source: hosted
version: "4.3.3"
version: "4.4.0"
very_good_analysis:
dependency: "direct dev"
description:
@@ -786,10 +786,10 @@ packages:
dependency: transitive
description:
name: web_socket_channel
sha256: "1d8e795e2a8b3730c41b8a98a2dff2e0fb57ae6f0764a1c46ec5915387d257b2"
sha256: "58c6666b342a38816b2e7e50ed0f1e261959630becd4c879c4f26bfa14aa5a42"
url: "https://pub.dev"
source: hosted
version: "2.4.4"
version: "2.4.5"
webkit_inspection_protocol:
dependency: transitive
description:
@@ -11,6 +11,7 @@ import 'package:shorebird_cli/src/logger.dart';
import 'package:shorebird_cli/src/platform.dart';
import 'package:shorebird_cli/src/platform/platform.dart';
import 'package:shorebird_cli/src/shorebird_env.dart';
import 'package:shorebird_cli/src/shorebird_web_console.dart';
import 'package:shorebird_cli/src/third_party/flutter_tools/lib/flutter_tools.dart';
import 'package:shorebird_code_push_client/shorebird_code_push_client.dart';
import 'package:test/test.dart';
@@ -455,12 +456,18 @@ void main() {
),
exitsWithCode(ExitCode.software),
);
final uri = ShorebirdWebConsole.appReleaseUri(
appId,
releaseId,
);
verify(
() => logger.err(
'''
It looks like you have an existing ios release for version ${lightCyan.wrap(release.version)}.
Please bump your version number and try again.''',
Please bump your version number and try again.
You can manage this release in the ${link(uri: uri, message: 'Shorebird Console')}''',
),
).called(1);
},
@@ -0,0 +1,20 @@
import 'package:shorebird_cli/src/shorebird_web_console.dart';
import 'package:test/test.dart';
void main() {
group(ShorebirdWebConsole, () {
test('uri returns the correct uri with the received path', () {
expect(
ShorebirdWebConsole.uri('path'),
Uri.parse('https://console.shorebird.dev/path'),
);
});
test('appReleaseUri returns the correct uri to an app release', () {
expect(
ShorebirdWebConsole.appReleaseUri('appId', 123),
Uri.parse('https://console.shorebird.dev/apps/appId/releases/123'),
);
});
});
}