mirror of
https://github.com/changesets/action
synced 2026-10-26 16:39:56 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd8d86bdc8 | ||
|
|
e8ffc2d207 | ||
|
|
1ed9bc24b7 | ||
|
|
5c0997b25e |
@@ -1,5 +1,13 @@
|
|||||||
# @changesets/action
|
# @changesets/action
|
||||||
|
|
||||||
|
## 1.2.0
|
||||||
|
|
||||||
|
### Minor Changes
|
||||||
|
|
||||||
|
- [#130](https://github.com/changesets/action/pull/130) [`5c0997b`](https://github.com/changesets/action/commit/5c0997b25e175ecf5e1723ba07210bbcea5d92fb) Thanks [@akphi](https://github.com/akphi)! - Added `createGithubReleases` input option (defaults to `true`) to control whether to create Github releases during publish or not.
|
||||||
|
|
||||||
|
* [#134](https://github.com/changesets/action/pull/134) [`1ed9bc2`](https://github.com/changesets/action/commit/1ed9bc24b7a56462c183eb815c8f4bdf0e2e5785) Thanks [@dmregister](https://github.com/dmregister)! - Added `cwd` input option that can be used in projects that are not in the root directory.
|
||||||
|
|
||||||
## 1.1.0
|
## 1.1.0
|
||||||
|
|
||||||
### Minor Changes
|
### Minor Changes
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ This action for [Changesets](https://github.com/atlassian/changesets) creates a
|
|||||||
- commit - The commit message to use. Default to `Version Packages`
|
- commit - The commit message to use. Default to `Version Packages`
|
||||||
- title - The pull request title. Default to `Version Packages`
|
- title - The pull request title. Default to `Version Packages`
|
||||||
- setupGitUser - Sets up the git user for commits as `"github-actions[bot]"`. Default to `true`
|
- setupGitUser - Sets up the git user for commits as `"github-actions[bot]"`. Default to `true`
|
||||||
|
- cwd - Changes node's `process.cwd()` if the project is not located on the root. Default to `process.cwd()`
|
||||||
|
|
||||||
### Outputs
|
### Outputs
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ inputs:
|
|||||||
version:
|
version:
|
||||||
description: "The command to update version, edit CHANGELOG, read and delete changesets. Default to `changeset version` if not provided"
|
description: "The command to update version, edit CHANGELOG, read and delete changesets. Default to `changeset version` if not provided"
|
||||||
required: false
|
required: false
|
||||||
|
cwd:
|
||||||
|
description: Sets the cwd for the node process. Default to `process.cwd()`
|
||||||
|
required: false
|
||||||
commit:
|
commit:
|
||||||
description: |
|
description: |
|
||||||
The commit message. Default to `Version Packages`
|
The commit message. Default to `Version Packages`
|
||||||
@@ -21,6 +24,10 @@ inputs:
|
|||||||
description: Sets up the git user for commits as `"github-actions[bot]"`. Default to `true`
|
description: Sets up the git user for commits as `"github-actions[bot]"`. Default to `true`
|
||||||
required: false
|
required: false
|
||||||
default: true
|
default: true
|
||||||
|
createGithubReleases:
|
||||||
|
description: "A boolean value to indicate whether to create Github releases after `publish` or not"
|
||||||
|
required: false
|
||||||
|
default: true
|
||||||
outputs:
|
outputs:
|
||||||
published:
|
published:
|
||||||
description: A boolean value to indicate whether a publishing is happened or not
|
description: A boolean value to indicate whether a publishing is happened or not
|
||||||
|
|||||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@changesets/action",
|
"name": "@changesets/action",
|
||||||
"version": "1.1.0",
|
"version": "1.2.0",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
+8
-1
@@ -14,7 +14,7 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let setupGitUser = core.getBooleanInput('setupGitUser');
|
let setupGitUser = core.getBooleanInput("setupGitUser");
|
||||||
|
|
||||||
if (setupGitUser) {
|
if (setupGitUser) {
|
||||||
console.log("setting git user");
|
console.log("setting git user");
|
||||||
@@ -27,6 +27,12 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
|
|||||||
`machine github.com\nlogin github-actions[bot]\npassword ${githubToken}`
|
`machine github.com\nlogin github-actions[bot]\npassword ${githubToken}`
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const inputCwd = core.getInput("cwd");
|
||||||
|
if (inputCwd) {
|
||||||
|
console.log("changing directory to the one given as the input");
|
||||||
|
process.chdir(inputCwd);
|
||||||
|
}
|
||||||
|
|
||||||
let { changesets } = await readChangesetState();
|
let { changesets } = await readChangesetState();
|
||||||
|
|
||||||
let publishScript = core.getInput("publish");
|
let publishScript = core.getInput("publish");
|
||||||
@@ -78,6 +84,7 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
|
|||||||
const result = await runPublish({
|
const result = await runPublish({
|
||||||
script: publishScript,
|
script: publishScript,
|
||||||
githubToken,
|
githubToken,
|
||||||
|
createGithubReleases: core.getBooleanInput("createGithubReleases"),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result.published) {
|
if (result.published) {
|
||||||
|
|||||||
+18
-12
@@ -51,6 +51,7 @@ const createRelease = async (
|
|||||||
type PublishOptions = {
|
type PublishOptions = {
|
||||||
script: string;
|
script: string;
|
||||||
githubToken: string;
|
githubToken: string;
|
||||||
|
createGithubReleases: boolean;
|
||||||
cwd?: string;
|
cwd?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -68,6 +69,7 @@ type PublishResult =
|
|||||||
export async function runPublish({
|
export async function runPublish({
|
||||||
script,
|
script,
|
||||||
githubToken,
|
githubToken,
|
||||||
|
createGithubReleases,
|
||||||
cwd = process.cwd(),
|
cwd = process.cwd(),
|
||||||
}: PublishOptions): Promise<PublishResult> {
|
}: PublishOptions): Promise<PublishResult> {
|
||||||
let octokit = github.getOctokit(githubToken);
|
let octokit = github.getOctokit(githubToken);
|
||||||
@@ -104,14 +106,16 @@ export async function runPublish({
|
|||||||
releasedPackages.push(pkg);
|
releasedPackages.push(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
await Promise.all(
|
if (createGithubReleases) {
|
||||||
releasedPackages.map((pkg) =>
|
await Promise.all(
|
||||||
createRelease(octokit, {
|
releasedPackages.map((pkg) =>
|
||||||
pkg,
|
createRelease(octokit, {
|
||||||
tagName: `${pkg.packageJson.name}@${pkg.packageJson.version}`,
|
pkg,
|
||||||
})
|
tagName: `${pkg.packageJson.name}@${pkg.packageJson.version}`,
|
||||||
)
|
})
|
||||||
);
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (packages.length === 0) {
|
if (packages.length === 0) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@@ -127,10 +131,12 @@ export async function runPublish({
|
|||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
releasedPackages.push(pkg);
|
releasedPackages.push(pkg);
|
||||||
await createRelease(octokit, {
|
if (createGithubReleases) {
|
||||||
pkg,
|
await createRelease(octokit, {
|
||||||
tagName: `v${pkg.packageJson.version}`,
|
pkg,
|
||||||
});
|
tagName: `v${pkg.packageJson.version}`,
|
||||||
|
});
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user