mirror of
https://github.com/changesets/action
synced 2026-10-26 16:39:56 +08:00
Add outputs variable published and publishedPackages (#26)
* Add outputs variable `published` * publishedPackages
This commit is contained in:
@@ -60,6 +60,8 @@ import readChangesets from "@changesets/read";
|
||||
|
||||
let publishScript = core.getInput("publish");
|
||||
let versionScript = core.getInput("version");
|
||||
core.setOutput('published', 'false');
|
||||
core.setOutput('publishedPackages', '[]');
|
||||
|
||||
if (!hasChangesets && !publishScript) {
|
||||
console.log("No changesets found");
|
||||
@@ -90,6 +92,7 @@ import readChangesets from "@changesets/read";
|
||||
publishCommand,
|
||||
publishArgs
|
||||
);
|
||||
|
||||
await exec("git", ["pull", "origin", branch]);
|
||||
|
||||
await exec("git", ["push", "origin", `HEAD:${branch}`, "--tags"]);
|
||||
@@ -149,6 +152,13 @@ import readChangesets from "@changesets/read";
|
||||
})
|
||||
);
|
||||
|
||||
if (releasedWorkspaces.length) {
|
||||
core.setOutput('published', 'true');
|
||||
core.setOutput('publishedPackages', JSON.stringify(releasedWorkspaces.map(
|
||||
workspace => ({name: workspace.name, version: workspace.config.version})
|
||||
)));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -165,7 +175,7 @@ import readChangesets from "@changesets/read";
|
||||
}
|
||||
|
||||
await exec("git", ["reset", "--hard", github.context.sha]);
|
||||
|
||||
|
||||
if (versionScript) {
|
||||
let [versionCommand, ...versionArgs] = versionScript.split(/\s+/);
|
||||
await exec(versionCommand, versionArgs);
|
||||
|
||||
Reference in New Issue
Block a user