diff --git a/bin/release b/bin/release
index 293575f1d..1ccbc075a 100755
--- a/bin/release
+++ b/bin/release
@@ -87,9 +87,11 @@ function bumpPhpPackages(string $version, bool $isMajor): void
*/
function cleanUpAfterRelease(): void
{
- // We want to still be able to `require tempest/package:dev-main`, so we need
- // to update back all composer files to use `dev-main` instead of a fixed version.
- executeCommands('./vendor/bin/monorepo-builder bump-interdependency dev-main');
+ $devVersion = sprintf("%s-dev", getCurrentBranch());
+
+ // We want to still be able to `require tempest/package:X.x-dev`, so we need
+ // to update back all composer files to use the dev version instead of a fixed version.
+ executeCommands("./vendor/bin/monorepo-builder bump-interdependency {$devVersion}");
// Finds all `composer.json` files in `packages/`, and revert the `tempest/highlight` dependency to the saved version
setPhpDependencyVersion(
@@ -145,7 +147,7 @@ function updateChangelog(string $version): void
/**
* Ensure the release script can run.
*/
-function performPreReleaseChecks(string $remote, string $branch): void
+function performPreReleaseChecks(string $remote): void
{
if (empty(shell_exec('which bun'))) {
throw new Exception('This script requires `bun` to be installed.');
@@ -155,6 +157,12 @@ function performPreReleaseChecks(string $remote, string $branch): void
throw new Exception('Repository must be in a clean state to release.');
}
+ $branch = getCurrentBranch();
+
+ if (! preg_match('/^\d+\.x$/', $branch)) {
+ throw new Exception("You must be on a version branch to release. Current branch is {$branch}.");
+ }
+
if (! str_starts_with(shell_exec('git rev-parse --abbrev-ref --symbolic-full-name @{u}'), "{$remote}/{$branch}")) {
throw new Exception("You must be on the {$remote}/{$branch} branch to release.");
}
@@ -205,7 +213,7 @@ function triggerSubsplit(): void
'Accept' => 'application/vnd.github+json',
'X-GitHub-Api-Version' => '2022-11-28',
],
- body: Json\encode(['ref' => 'main']),
+ body: Json\encode(['ref' => getCurrentBranch()]),
);
if (! $response->status->isSuccessful()) {
@@ -222,6 +230,14 @@ function getCurrentVersion(): string
return exec('git describe --tags --abbrev=0');
}
+/**
+ * Gets the current git branch name.
+ */
+function getCurrentBranch(): string
+{
+ return trim(shell_exec('git rev-parse --abbrev-ref HEAD') ?? '');
+}
+
/**
* Suggests a semver-valid version.
*/
@@ -344,7 +360,7 @@ function ensureTagDoesNotExist(string $version): void
try {
ConsoleApplication::boot();
- performPreReleaseChecks('origin', 'main');
+ performPreReleaseChecks('origin');
$console = get(Console::class);
$console->writeln();
diff --git a/packages/console/src/Exceptions/ConsoleExceptionHandler.php b/packages/console/src/Exceptions/ConsoleExceptionHandler.php
index fdea32aa7..3c9d20f9f 100644
--- a/packages/console/src/Exceptions/ConsoleExceptionHandler.php
+++ b/packages/console/src/Exceptions/ConsoleExceptionHandler.php
@@ -55,12 +55,15 @@ public function handle(Throwable $throwable): void
$this->console->writeln();
} else {
- $this->console
- ->writeln(' ' . $this->formatTrace($throwable->getTrace()[0]))
- ->writeln(' ' . $this->formatTrace($throwable->getTrace()[1]))
- ->writeln()
- ->writeln(' ')
- ->writeln();
+ $this->console->writeln(' ' . $this->formatTrace($throwable->getTrace()[0]));
+
+ if (count($throwable->getTrace()) > 1) {
+ $this->console->writeln(' ' . $this->formatTrace($throwable->getTrace()[1]));
+ }
+
+ $this->console->writeln();
+ $this->console->writeln(' ');
+ $this->console->writeln();
}
} finally {
$exitCode = $throwable instanceof HasExitCode