diff --git a/CHANGELOG.md b/CHANGELOG.md index bbc814381..1385d1bc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ # 0.33.6 (Mon Dec 17 2018) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - url isn't required for pr or pr-check [#99](https://github.com/intuit/auto-release/pull/99) ([@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -24,7 +24,7 @@ # 0.33.5 (Mon Dec 17 2018) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - pr-check wasn't getting semver labelTexts correctly [#98](https://github.com/intuit/auto-release/pull/98) ([@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -36,7 +36,7 @@ # 0.33.4 (Mon Dec 17 2018) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - Change slack flag to boolean [#96](https://github.com/intuit/auto-release/pull/96) ([@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -48,7 +48,7 @@ # 0.33.3 (Sun Dec 16 2018) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - only error if there are actually missing args [#95](https://github.com/intuit/auto-release/pull/95) ([@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -60,17 +60,17 @@ # 0.33.1 (Sun Dec 16 2018) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - missed adding no release labels to `pr-check` [#89](https://github.com/intuit/auto-release/pull/89) ([@hipstersmoothie](https://github.com/hipstersmoothie)) - update deps [#85](https://github.com/intuit/auto-release/pull/85) ([@hipstersmoothie](https://github.com/hipstersmoothie)) -#### 🏠 Internal +#### 🏠 Internal - fix version number [#92](https://github.com/intuit/auto-release/pull/92) ([@hipstersmoothie](https://github.com/hipstersmoothie)) - only publish docs with documentation label [#86](https://github.com/intuit/auto-release/pull/86) ([@hipstersmoothie](https://github.com/hipstersmoothie)) -#### 📝 Documentation +#### 📝 Documentation - fix docs publish [#88](https://github.com/intuit/auto-release/pull/88) ([@hipstersmoothie](https://github.com/hipstersmoothie)) - Clearer wording [#87](https://github.com/intuit/auto-release/pull/87) ([@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -83,7 +83,7 @@ # 0.33.0 (Sun Dec 16 2018) -#### 🚀 Enhancement +#### 🚀 Enhancement - Default `label` to last merged PR [#83](https://github.com/intuit/auto-release/pull/83) ([@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -95,11 +95,11 @@ # 0.32.2 (Sun Dec 16 2018) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - unneeded long desc on chengelog cli [#81](https://github.com/intuit/auto-release/pull/81) ([@hipstersmoothie](https://github.com/hipstersmoothie)) -#### 📝 Documentation +#### 📝 Documentation - doc ordering [#80](https://github.com/intuit/auto-release/pull/80) ([@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -111,11 +111,11 @@ # 0.32.1 (Sun Dec 16 2018) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - Formatted Changelogs [#79](https://github.com/intuit/auto-release/pull/79) ([@hipstersmoothie](https://github.com/hipstersmoothie)) -#### 📝 Documentation +#### 📝 Documentation - Document process for onboarding an already published repo [#78](https://github.com/intuit/auto-release/pull/78) ([@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -193,7 +193,7 @@ #### 📝 Documentation -- Add docs for `noReleaseLabels` [#57](https://github.com/intuit/auto-release/pull/57) ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Add docs for `skipReleaseLabels` [#57](https://github.com/intuit/auto-release/pull/57) ([@hipstersmoothie](https://github.com/hipstersmoothie)) - Badge [#56](https://github.com/intuit/auto-release/pull/56) ([@hipstersmoothie](https://github.com/hipstersmoothie)) #### Authors: 1 diff --git a/README.md b/README.md index 893c3ae6e..1ffd17b00 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ CI/CD helpers for github releases. Generate releases based on semantic version l Release Features: - Release every merge to master based on a PR labels -- Skip a release with the `no-release` label +- Skip a release with the `skip-release` label - Generate a changelog with fancy headers, authors, and monorepo package association - Generate a Github release diff --git a/docs/pages/auto-pr-check.md b/docs/pages/auto-pr-check.md index baeacbd57..5bc99b6af 100644 --- a/docs/pages/auto-pr-check.md +++ b/docs/pages/auto-pr-check.md @@ -17,7 +17,7 @@ Options --url string URL to associate with this status --onlyPublishWithReleaseLabel Only bump version if 'release' label is on pull request --context string A string label to differentiate this status from others - --noReleaseLabels string[] Labels that will not create a release. Defaults to just 'no-release' + --skipReleaseLabels string[] Labels that will not create a release. Defaults to just 'skip-release' Global Options diff --git a/docs/pages/auto-version.md b/docs/pages/auto-version.md index 80cb26882..0f7097402 100644 --- a/docs/pages/auto-version.md +++ b/docs/pages/auto-version.md @@ -8,7 +8,7 @@ Get the semantic version bump for the given changes. Requires all PRs to have la Options --onlyPublishWithReleaseLabel Only bump version if 'release' label is on pull request - --noReleaseLabels string[] Labels that will not create a release. Defaults to just 'no-release' + --skipReleaseLabels string[] Labels that will not create a release. Defaults to just 'skip-release' Global Options @@ -22,7 +22,7 @@ Global Options Examples Get the new version using the last release to head $ auto version - Skip releases with multiple labels $ auto version --noReleaseLabels documentation CI + Skip releases with multiple labels $ auto version --skipReleaseLabels documentation CI ``` Useful in conjunction with `npm version` to auto-version releases. @@ -33,18 +33,18 @@ To create a prerelease add the `prerelease` label to your pull request. ## No Release -To not create a release for a pull request add the `no-release` label. Any pull request with this tag will make `auto version` return `''`. +To not create a release for a pull request add the `skip-release` label. Any pull request with this tag will make `auto version` return `''`. ::: message is-warning -:warning: You must check the return value of `auto version` in a bash script like in the example configuration for the `no-release` label to function properly. +:warning: You must check the return value of `auto version` in a bash script like in the example configuration for the `skip-release` label to function properly. ::: ### Multiple -You can configure multiple labels to skip releasing as well. To do this use the `noReleaseLabels` options. This can also be configured via the [.autorc](./autorc.md#multiple-no-version). +You can configure multiple labels to skip releasing as well. To do this use the `skipReleaseLabels` options. This can also be configured via the [.autorc](./autorc.md#multiple-no-version). ```sh -auto version --noReleaseLabels project-files --noReleaseLabels documentation +auto version --skipReleaseLabels project-files --skipReleaseLabels documentation ``` ## Configure Versioning Labels diff --git a/docs/pages/autorc.md b/docs/pages/autorc.md index 39f5c46a8..8426913e7 100644 --- a/docs/pages/autorc.md +++ b/docs/pages/autorc.md @@ -31,7 +31,7 @@ To override the label text used for versioning define new labels in the `.autorc "major": "Version: Major", "minor": "Version: Minor", "patch": "Version: Patch", - "no-release": "NO!", + "skip-release": "NO!", "release": "Autobots, rollout!", "prerelease": "beta" } @@ -44,7 +44,7 @@ You can configure multiple labels to skip releases. ```json { - "noReleaseLabels": ["documentation", "project-files"] + "skipReleaseLabels": ["documentation", "project-files"] } ``` diff --git a/docs/pages/getting-started.md b/docs/pages/getting-started.md index 9737f6d63..9db604c10 100644 --- a/docs/pages/getting-started.md +++ b/docs/pages/getting-started.md @@ -82,7 +82,7 @@ To version, changelog, publish and release your code all at the same time, we've #### Detailed Setup -The simplest workflow to get set up in just the `package.json` is by adding the following to your `package.json`. With this setup your application will not be able to use the `no-release` flag, but everything else will work just fine +The simplest workflow to get set up in just the `package.json` is by adding the following to your `package.json`. With this setup your application will not be able to use the `skip-release` flag, but everything else will work just fine ```json { @@ -94,9 +94,9 @@ The simplest workflow to get set up in just the `package.json` is by adding the } ``` -##### Enabling `no-release` label +##### Enabling `skip-release` label -To use the `no-release` label you have to get a little more involved and use a shell script. We could do the `if` checks in the `package.json`, but this would get messy and hard to read very quickly. +To use the `skip-release` label you have to get a little more involved and use a shell script. We could do the `if` checks in the `package.json`, but this would get messy and hard to read very quickly. ```json { @@ -113,7 +113,7 @@ export PATH=$(npm bin):$PATH VERSION=`auto version` -## Support for label 'no-release' +## Support for label 'skip-release' if [ ! -z "$VERSION" ]; then ## Update Changelog auto changelog diff --git a/docs/pages/introduction.md b/docs/pages/introduction.md index 655a47a60..8501c69e5 100644 --- a/docs/pages/introduction.md +++ b/docs/pages/introduction.md @@ -7,7 +7,7 @@ CI/CD helpers for github releases. Generate releases based on semantic version l Release Features: - Release every merge to master based on a PR labels -- Skip a release with the `no-release` label +- Skip a release with the `skip-release` label - Generate a changelog with fancy headers, authors, and monorepo package association - Generate a Github release diff --git a/src/__tests__/github-release.test.ts b/src/__tests__/github-release.test.ts index 998a095f3..072fc0fa7 100644 --- a/src/__tests__/github-release.test.ts +++ b/src/__tests__/github-release.test.ts @@ -357,9 +357,9 @@ describe('GithubRelease', () => { ]; getGitLog.mockReturnValueOnce(commits); - getLabels.mockReturnValueOnce(['no-release', 'patch']); - getLabels.mockReturnValueOnce(['no-release', 'patch']); - getLabels.mockReturnValueOnce(['no-release', 'minor']); + getLabels.mockReturnValueOnce(['skip-release', 'patch']); + getLabels.mockReturnValueOnce(['skip-release', 'patch']); + getLabels.mockReturnValueOnce(['skip-release', 'minor']); expect(await gh.getSemverBump('1234', '123')).toBe(''); }); @@ -374,8 +374,8 @@ describe('GithubRelease', () => { getGitLog.mockReturnValueOnce(commits); getLabels.mockReturnValueOnce(['patch']); - getLabels.mockReturnValueOnce(['no-release', 'patch']); - getLabels.mockReturnValueOnce(['no-release', 'minor']); + getLabels.mockReturnValueOnce(['skip-release', 'patch']); + getLabels.mockReturnValueOnce(['skip-release', 'minor']); expect(await gh.getSemverBump('1234', '123')).toBe(SEMVER.minor); }); @@ -389,7 +389,7 @@ describe('GithubRelease', () => { ]; getGitLog.mockReturnValueOnce(commits); - getLabels.mockReturnValueOnce(['no-release']); + getLabels.mockReturnValueOnce(['skip-release']); getLabels.mockReturnValueOnce([]); getLabels.mockReturnValueOnce([]); @@ -502,16 +502,16 @@ describe('GithubRelease', () => { expect(createLabel).toHaveBeenCalledWith('release', 'deploy'); }); - test('should add no-release label not in onlyPublishWithReleaseLabel mode', async () => { + test('should add skip-release label not in onlyPublishWithReleaseLabel mode', async () => { const gh = new GithubRelease(); const labels = new Map(); - labels.set('no-release', 'no!'); + labels.set('skip-release', 'no!'); await gh.addLabelsToProject(labels, true); - expect(createLabel).not.toHaveBeenCalledWith('no-release', 'no!'); + expect(createLabel).not.toHaveBeenCalledWith('skip-release', 'no!'); await gh.addLabelsToProject(labels); - expect(createLabel).toHaveBeenCalledWith('no-release', 'no!'); + expect(createLabel).toHaveBeenCalledWith('skip-release', 'no!'); }); }); }); diff --git a/src/__tests__/semver.test.ts b/src/__tests__/semver.test.ts index c03a6442c..f8edc0b02 100644 --- a/src/__tests__/semver.test.ts +++ b/src/__tests__/semver.test.ts @@ -20,22 +20,22 @@ describe('calculateSemVerBump', () => { ); }); - test('should be able to use multiple labels for no-release', () => { + test('should be able to use multiple labels for skip-release', () => { expect( - calculateSemVerBump([['no-release', 'major']], defaultLabels, { - noReleaseLabels: ['documentation'] + calculateSemVerBump([['skip-release', 'major']], defaultLabels, { + skipReleaseLabels: ['documentation'] }) ).toBe(SEMVER.noVersion); expect( calculateSemVerBump([['documentation', 'major']], defaultLabels, { - noReleaseLabels: ['documentation'] + skipReleaseLabels: ['documentation'] }) ).toBe(SEMVER.noVersion); expect( calculateSemVerBump([['major']], defaultLabels, { - noReleaseLabels: ['documentation'] + skipReleaseLabels: ['documentation'] }) ).toBe(SEMVER.major); }); diff --git a/src/auto-rc.json b/src/auto-rc.json index 379d38918..a93468e1a 100644 --- a/src/auto-rc.json +++ b/src/auto-rc.json @@ -23,7 +23,7 @@ "type": "string", "description": "Label used to mark a pull request as a patch release" }, - "no-release": { + "skip-release": { "type": "string", "description": "Do not create a release for this PR. Is ignored when in `onlyPublishWithReleaseLabel` mode." }, diff --git a/src/cli/args.ts b/src/cli/args.ts index bffbb4a86..99262c893 100644 --- a/src/cli/args.ts +++ b/src/cli/args.ts @@ -147,13 +147,13 @@ const message: commandLineUsage.OptionDefinition = { alias: 'm' }; -const noReleaseLabels: commandLineUsage.OptionDefinition = { - name: 'noReleaseLabels', +const skipReleaseLabels: commandLineUsage.OptionDefinition = { + name: 'skipReleaseLabels', type: String, group: 'main', multiple: true, description: - "Labels that will not create a release. Defaults to just 'no-release'" + "Labels that will not create a release. Defaults to just 'skip-release'" }; interface ICommand { @@ -206,7 +206,7 @@ const commands: ICommand[] = [ ...context, defaultValue: 'ci/pr-check' }, - noReleaseLabels, + skipReleaseLabels, ...defaultOptions ], examples: [ @@ -255,7 +255,11 @@ const commands: ICommand[] = [ { name: 'version', summary: 'Get the semantic version bump for the given changes.', - options: [onlyPublishWithReleaseLabel, noReleaseLabels, ...defaultOptions], + options: [ + onlyPublishWithReleaseLabel, + skipReleaseLabels, + ...defaultOptions + ], examples: [ { desc: 'Get the new version using the last release to head', @@ -263,7 +267,7 @@ const commands: ICommand[] = [ }, { desc: 'Skip releases with multiple labels', - example: '{green $} auto version --noReleaseLabels documentation CI' + example: '{green $} auto version --skipReleaseLabels documentation CI' } ] }, @@ -521,7 +525,7 @@ export default function parseArgs(testArgs?: string[]) { } export interface ISemverArgs { - noReleaseLabels?: string[]; + skipReleaseLabels?: string[]; onlyPublishWithReleaseLabel?: boolean; jira?: string; slack?: string; diff --git a/src/github-release.ts b/src/github-release.ts index aad4e40b6..5ae500a1d 100644 --- a/src/github-release.ts +++ b/src/github-release.ts @@ -21,7 +21,7 @@ export type VersionLabel = | SEMVER.major | SEMVER.minor | SEMVER.patch - | 'no-release' + | 'skip-release' | 'release' | 'prerelease'; @@ -29,7 +29,7 @@ export const defaultLabels = new Map(); defaultLabels.set(SEMVER.major, 'major'); defaultLabels.set(SEMVER.minor, 'minor'); defaultLabels.set(SEMVER.patch, 'patch'); -defaultLabels.set('no-release', 'no-release'); +defaultLabels.set('skip-release', 'skip-release'); defaultLabels.set('release', 'release'); defaultLabels.set('prerelease', 'prerelease'); @@ -45,7 +45,7 @@ export const defaultLabelsDescriptions = new Map(); defaultLabelsDescriptions.set(SEMVER.major, 'create a major release'); defaultLabelsDescriptions.set(SEMVER.minor, 'create a minor release'); defaultLabelsDescriptions.set(SEMVER.patch, 'create a patch release'); -defaultLabelsDescriptions.set('no-release', 'do not create a release'); +defaultLabelsDescriptions.set('skip-release', 'do not create a release'); defaultLabelsDescriptions.set( 'release', 'publish a release when this pr is merged' @@ -337,7 +337,7 @@ export default class GithubRelease { return; } - if (versionLabel === 'no-release' && onlyPublishWithReleaseLabel) { + if (versionLabel === 'skip-release' && onlyPublishWithReleaseLabel) { return; } @@ -350,11 +350,11 @@ export default class GithubRelease { from: string, to = 'HEAD', onlyPublishWithReleaseLabel = false, - noReleaseLabels: string[] = [] + skipReleaseLabels: string[] = [] ): Promise { const commits = await this.getCommits(from, to); const labels = commits.map(commit => commit.labels); - const options = { onlyPublishWithReleaseLabel, noReleaseLabels }; + const options = { onlyPublishWithReleaseLabel, skipReleaseLabels }; const versionLabels = new Map([...defaultLabels, ...this.userLabels]); this.logger.verbose.info('Calculating SEMVER bump using:\n', { diff --git a/src/init.ts b/src/init.ts index 6cc20bb99..69988f605 100644 --- a/src/init.ts +++ b/src/init.ts @@ -78,7 +78,7 @@ async function getLabels() { major: #{major} minor: #{minor} patch: #{patch} -no-release: #{no-release} +skip-release: #{skip-release} release: #{release} prerelease: #{prerelease} internal: #{internal} diff --git a/src/main.ts b/src/main.ts index 4a4fb0168..befc8337f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -107,7 +107,7 @@ async function getVersion(githubRelease: GithubRelease, args: ArgsType) { lastRelease, undefined, args.onlyPublishWithReleaseLabel, - args.noReleaseLabels + args.skipReleaseLabels ); } @@ -337,21 +337,21 @@ export async function run(args: ArgsType) { const labels = await githubRelease.getLabels(args.pr!); const labelTexts = [...semVerLabels.values()]; const releaseTag = labels.find(l => l === 'release'); - const noReleaseLabels = args.noReleaseLabels || []; + const skipReleaseLabels = args.skipReleaseLabels || []; - if (!noReleaseLabels.includes(semVerLabels.get('no-release')!)) { - noReleaseLabels.push(semVerLabels.get('no-release')!); + if (!skipReleaseLabels.includes(semVerLabels.get('skip-release')!)) { + skipReleaseLabels.push(semVerLabels.get('skip-release')!); } - const noReleaseTag = labels.find(l => noReleaseLabels.includes(l)); + const skipReleaseTag = labels.find(l => skipReleaseLabels.includes(l)); const semverTag = labels.find( l => labelTexts.includes(l) && - !noReleaseLabels.includes(l) && + !skipReleaseLabels.includes(l) && l !== 'release' ); - if (semverTag === undefined && !noReleaseTag) { + if (semverTag === undefined && !skipReleaseTag) { throw new Error('No semver label!'); } @@ -359,7 +359,7 @@ export async function run(args: ArgsType) { let description; - if (noReleaseTag) { + if (skipReleaseTag) { description = 'PR will not create a release'; } else if (releaseTag) { description = `PR will create release once merged - ${semverTag}`; diff --git a/src/semver.ts b/src/semver.ts index 4916efcd9..4472e8d70 100644 --- a/src/semver.ts +++ b/src/semver.ts @@ -28,18 +28,18 @@ export function getHigherSemverTag(left: string, right: string): SEMVER { interface ISemVerOptions { onlyPublishWithReleaseLabel?: boolean; - noReleaseLabels?: string[]; + skipReleaseLabels?: string[]; } export function calculateSemVerBump( labels: string[][], labelMap: IVersionLabels, - { onlyPublishWithReleaseLabel, noReleaseLabels = [] }: ISemVerOptions = {} + { onlyPublishWithReleaseLabel, skipReleaseLabels = [] }: ISemVerOptions = {} ) { const labelSet = new Set(); - if (!noReleaseLabels.includes(labelMap.get('no-release')!)) { - noReleaseLabels.push(labelMap.get('no-release')!); + if (!skipReleaseLabels.includes(labelMap.get('skip-release')!)) { + skipReleaseLabels.push(labelMap.get('skip-release')!); } labels.map(pr => @@ -49,14 +49,14 @@ export function calculateSemVerBump( }) ); - let noRelease = false; + let skipRelease = false; let isPrerelease = false; if (labels.length > 0 && labels[0].length > 0) { isPrerelease = labels[0].includes(labelMap.get('prerelease')!); - noRelease = onlyPublishWithReleaseLabel + skipRelease = onlyPublishWithReleaseLabel ? !labels[0].includes(labelMap.get('release')!) - : !!labels[0].find(label => noReleaseLabels.includes(label)); + : !!labels[0].find(label => skipReleaseLabels.includes(label)); } const version = [...labelSet].reduce( @@ -64,7 +64,7 @@ export function calculateSemVerBump( SEMVER.patch ); - if (noRelease) { + if (skipRelease) { return SEMVER.noVersion; }