Skip to content

Commit 6209d07

Browse files
authored
chore(publish): improve git push error handling (#659)
chore(publish): improve git push error handling chore: release 0.6.0-rc.1 Release-As: 0.6.0-rc.1
1 parent 9f015f8 commit 6209d07

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

scripts/publish.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ async function bumpPackageVersions(version: string) {
4242
async function commitVersionChanges(version: string) {
4343
console.log(chalk.blue("Committing..."));
4444
await $`git add .`;
45-
45+
4646
// Check if there are changes to commit
4747
const { stdout: statusOutput } = await $`git status --porcelain`;
4848
if (statusOutput.trim()) {
@@ -51,9 +51,16 @@ async function commitVersionChanges(version: string) {
5151
} else {
5252
console.log(chalk.yellow("No changes to commit for version bump"));
5353
}
54-
54+
5555
await $`git commit --allow-empty -m "chore: release ${version}" -m "Release-As: ${version}"`;
56-
await $`git push`;
56+
57+
const { exitCode: pushExitCode } = await $({ nothrow: true })`git push`;
58+
if (pushExitCode !== 0) {
59+
console.warn(
60+
chalk.yellow("! Failed to push branch. You may need to push manually."),
61+
);
62+
}
63+
5764
await $`git push --tags -f`;
5865
}
5966

@@ -70,7 +77,10 @@ async function getPublicPackages() {
7077

7178
function validatePackages(publicPackages: any[]) {
7279
const nonActorCorePackages = publicPackages.filter(
73-
(pkg) => pkg.name !== "actor-core" && pkg.name !== "create-actor" && !pkg.name.startsWith("@actor-core/"),
80+
(pkg) =>
81+
pkg.name !== "actor-core" &&
82+
pkg.name !== "create-actor" &&
83+
!pkg.name.startsWith("@actor-core/"),
7484
);
7585

7686
if (nonActorCorePackages.length > 0) {

0 commit comments

Comments
 (0)