Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cold-melons-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@changesets/action": patch
---

Fixed an issue with GitHub releases not being created for successfully published packages when _some_ packages failed to be published to the registry.
13 changes: 13 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,19 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
JSON.stringify(result.publishedPackages)
);
}

if (result.exitCode !== 0) {
core.error(
`Publish command exited with code ${result.exitCode}${
result.published
? `, but some packages were published: ${result.publishedPackages
.map((p) => `${p.name}@${p.version}`)
.join(", ")}`
: ""
}`
);
process.exit(result.exitCode);
}
return;
}
case hasChangesets && !hasNonEmptyChangesets:
Expand Down
7 changes: 5 additions & 2 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,11 @@ type PublishResult =
| {
published: true;
publishedPackages: PublishedPackage[];
exitCode: number;
}
| {
published: false;
exitCode: number;
};

export async function runPublish({
Expand All @@ -89,7 +91,7 @@ export async function runPublish({
let changesetPublishOutput = await getExecOutput(
publishCommand,
publishArgs,
{ cwd }
{ cwd, ignoreReturnCode: true }
);

let { packages, tool } = await getPackages(cwd);
Expand Down Expand Up @@ -156,10 +158,11 @@ export async function runPublish({
name: pkg.packageJson.name,
version: pkg.packageJson.version,
})),
exitCode: changesetPublishOutput.exitCode,
};
}

return { published: false };
return { published: false, exitCode: changesetPublishOutput.exitCode };
}

const requireChangesetsCliPkgJson = (cwd: string) => {
Expand Down