mirror of
https://github.com/changesets/action
synced 2026-10-26 16:39:56 +08:00
Fixed an issue with GitHub releases not being created for successfully published packages when some packages failed to be published (#535)
* Fixed an issue with GitHub releases not being created for successfully published packages when some packages failed to be published * Format --------- Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
This commit is contained in:
co-authored by
Bjorn Lu
parent
1d54b9e660
commit
34f64f6e2e
@@ -136,6 +136,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:
|
||||
|
||||
+5
-1
@@ -73,9 +73,11 @@ type PublishResult =
|
||||
| {
|
||||
published: true;
|
||||
publishedPackages: PublishedPackage[];
|
||||
exitCode: number;
|
||||
}
|
||||
| {
|
||||
published: false;
|
||||
exitCode: number;
|
||||
};
|
||||
|
||||
export async function runPublish({
|
||||
@@ -88,6 +90,7 @@ export async function runPublish({
|
||||
}: PublishOptions): Promise<PublishResult> {
|
||||
let changesetPublishOutput = await getExecOutput(script, undefined, {
|
||||
cwd,
|
||||
ignoreReturnCode: true,
|
||||
env: { ...process.env, GITHUB_TOKEN: githubToken },
|
||||
});
|
||||
|
||||
@@ -155,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) => {
|
||||
|
||||
Reference in New Issue
Block a user