Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to restrict publishing to greater package version only #44

Merged
Merged
Changes from 1 commit
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
Prev Previous commit
Merge branch 'master' into feature/greater-package-version
  • Loading branch information
philsturgeon authored May 13, 2022
commit 45b397d9cfac26bb1f68eeed5959a57a08fa09fb
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -63,16 +63,17 @@ jobs:

You can set any or all of the following input parameters:

| Name | Type | Required? | Default | Description |
| ---------------------- | ------- | --------- | ------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `token` | string | yes | | The NPM auth token to use for publishing |
| `registry` | string | no | https://registry.npmjs.org/ | The NPM registry URL to use |
| `package` | string | no | ./package.json | The path of your package.json file |
| `tag` | string | no | "latest" | The tag to publish to. This allows people to install the package using `npm install <package-name>@<tag>`. |
| `access` | string | no | "public" for non-scoped packages. "restricted" for scoped packages. | Determines whether the published package should be publicly visible, or restricted to members of your NPM organization. |
| `dry-run` | boolean | no | false | Run NPM publish with the `--dry-run` flag to prevent publication |
| `check-version` | boolean | no | true | Only publish to NPM if the version number in `package.json` differs from the latest on NPM |
| `greater-version-only` | boolean | no | false | Only publish to NPM if the version number in `package.json` is greater than the latest on NPM |
|Name |Type |Default |Description
|----------------------|-------- |----------------------------|------------------------------------
|`token` |string |**required** |The NPM auth token to use for publishing
|`registry` |string |https://registry.npmjs.org/ |The NPM registry URL to use
|`package` |string |./package.json |The path of your package.json file
|`tag` |string |"latest" |The tag to publish to. This allows people to install the package using `npm install <package-name>@<tag>`.
|`access` |string |"public" for non-scoped packages. "restricted" for scoped packages.|Determines whether the published package should be publicly visible, or restricted to members of your NPM organization.
|`dry-run` |boolean |false |Run NPM publish with the `--dry-run` flag to prevent publication
|`check-version` |boolean |true |Only publish to NPM if the version number in `package.json` differs from the latest on NPM
|`greater-version-only`|boolean |false |Only publish to NPM if the version number in `package.json` is greater than the latest on NPM |


## Output Variables

8 changes: 4 additions & 4 deletions src/action/index.ts
Original file line number Diff line number Diff line change
@@ -32,22 +32,22 @@ async function main(): Promise<void> {

if (results.type === "none") {
console.log(
`\n📦 ${results.package} v${results.version} is already published to NPM`
`\n📦 ${results.package} v${results.version} is already published to ${options.registry}`
);
}
if (results.type === "lower") {
console.log(
`\n📦 ${results.package} v${results.version} is lower than the version published to NPM`
`\n📦 ${results.package} v${results.version} is lower than the version published to ${options.registry}`
);
}
else if (results.dryRun) {
console.log(
`\n📦 ${results.package} v${results.version} was NOT actually published to NPM (dry run)`
`\n📦 ${results.package} v${results.version} was NOT actually published to ${options.registry} (dry run)`
);
}
else {
console.log(
`\n📦 Successfully published ${results.package} v${results.version} to NPM`
`\n📦 Successfully published ${results.package} v${results.version} to ${options.registry}`
);
}

You are viewing a condensed version of this merge commit. You can view the full changes here.