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
@@ -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.
|
||||||
@@ -136,6 +136,19 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
|
|||||||
JSON.stringify(result.publishedPackages),
|
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;
|
return;
|
||||||
}
|
}
|
||||||
case hasChangesets && !hasNonEmptyChangesets:
|
case hasChangesets && !hasNonEmptyChangesets:
|
||||||
|
|||||||
+5
-1
@@ -73,9 +73,11 @@ type PublishResult =
|
|||||||
| {
|
| {
|
||||||
published: true;
|
published: true;
|
||||||
publishedPackages: PublishedPackage[];
|
publishedPackages: PublishedPackage[];
|
||||||
|
exitCode: number;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
published: false;
|
published: false;
|
||||||
|
exitCode: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function runPublish({
|
export async function runPublish({
|
||||||
@@ -88,6 +90,7 @@ export async function runPublish({
|
|||||||
}: PublishOptions): Promise<PublishResult> {
|
}: PublishOptions): Promise<PublishResult> {
|
||||||
let changesetPublishOutput = await getExecOutput(script, undefined, {
|
let changesetPublishOutput = await getExecOutput(script, undefined, {
|
||||||
cwd,
|
cwd,
|
||||||
|
ignoreReturnCode: true,
|
||||||
env: { ...process.env, GITHUB_TOKEN: githubToken },
|
env: { ...process.env, GITHUB_TOKEN: githubToken },
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -155,10 +158,11 @@ export async function runPublish({
|
|||||||
name: pkg.packageJson.name,
|
name: pkg.packageJson.name,
|
||||||
version: pkg.packageJson.version,
|
version: pkg.packageJson.version,
|
||||||
})),
|
})),
|
||||||
|
exitCode: changesetPublishOutput.exitCode,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return { published: false };
|
return { published: false, exitCode: changesetPublishOutput.exitCode };
|
||||||
}
|
}
|
||||||
|
|
||||||
const requireChangesetsCliPkgJson = (cwd: string) => {
|
const requireChangesetsCliPkgJson = (cwd: string) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user