Skip to content

Commit

Permalink
fix: fix maintenance branch regex
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdlg committed May 9, 2019
1 parent d10268a commit a022996
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs/developer-guide/js-api.md
Expand Up @@ -13,7 +13,7 @@ try {
const result = await semanticRelease({
// Core options
branches: [
'+([1-9])?(.{+([1-9]),x}).x',
'+([0-9])?(.{+([0-9]),x}).x',
'master',
'next',
'next-major',
Expand Down
2 changes: 1 addition & 1 deletion docs/recipes/distribution-channels.md
Expand Up @@ -3,7 +3,7 @@
This recipe will walk you through a simple example that uses distribution channels to make releases available only to a subset of users, in order to collect feedbacks before distributing the release to all users.

This example uses the **semantic-release** default configuration:
- [branches](../usage/configuration.md#branches): `['+([1-9])?(.{+([1-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]`
- [branches](../usage/configuration.md#branches): `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]`
- [plugins](../usage/configuration.md#plugins): `['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/npm', '@semantic-release/github']`

## Initial release
Expand Down
2 changes: 1 addition & 1 deletion docs/recipes/maintenance-releases.md
Expand Up @@ -3,7 +3,7 @@
This recipe will walk you through a simple example that uses Git branches and distribution channels to publish fixes and features for old versions of a package.

This example uses the **semantic-release** default configuration:
- [branches](../usage/configuration.md#branches): `['+([1-9])?(.{+([1-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]`
- [branches](../usage/configuration.md#branches): `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]`
- [plugins](../usage/configuration.md#plugins): `['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/npm', '@semantic-release/github']`

## Initial release
Expand Down
2 changes: 1 addition & 1 deletion docs/recipes/pre-releases.md
Expand Up @@ -3,7 +3,7 @@
This recipe will walk you through a simple example that uses pre-releases to publish beta versions while working on a future major release and then make only one release on the default distribution.

This example uses the **semantic-release** default configuration:
- [branches](../usage/configuration.md#branches): `['+([1-9])?(.{+([1-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]`
- [branches](../usage/configuration.md#branches): `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]`
- [plugins](../usage/configuration.md#plugins): `['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/npm', '@semantic-release/github']`

## Initial release
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/configuration.md
Expand Up @@ -70,7 +70,7 @@ List of modules or file paths containing a [shareable configuration](shareable-c
### branches

Type: `Array`, `String`, `Object`<br>
Default: `['+([1-9])?(.{+([1-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]`<br>
Default: `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]`<br>
CLI arguments: `--branches`

The branches on which releases should happen. By default **semantic-release** will release:
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/workflow-configuration.md
Expand Up @@ -34,7 +34,7 @@ It can be defined as a [glob](https://github.com/micromatch/micromatch#matching-

If `name` doesn't match to any branch existing in the repository, the definition will be ignored. For example the default configuration includes the definition `next` and `next-major` which will become active only when the branches `next` and/or `next-major` are created in the repository. This allow to define your workflow once with all potential branches you might use and have the effective configuration evolving as you create new branches.

For example the configuration `['+([1-9])?(.{+([1-9]),x}).x', 'master', 'next']` will be expanded as:
For example the configuration `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'next']` will be expanded as:
```js
{
branches: [
Expand Down
2 changes: 1 addition & 1 deletion lib/get-config.js
Expand Up @@ -67,7 +67,7 @@ module.exports = async (context, opts) => {
// Set default options values if not defined yet
options = {
branches: [
'+([1-9])?(.{+([1-9]),x}).x',
'+([0-9])?(.{+([0-9]),x}).x',
'master',
'next',
'next-major',
Expand Down
8 changes: 4 additions & 4 deletions test/branches/expand.test.js
Expand Up @@ -6,9 +6,9 @@ test('Expand branches defined with globs', async t => {
const {cwd, repositoryUrl} = await gitRepo(true);
await gitCommits(['First'], {cwd});
await gitPush(repositoryUrl, 'master', {cwd});
await gitCheckout('1.1.x', true, {cwd});
await gitCheckout('1.0.x', true, {cwd});
await gitCommits(['Second'], {cwd});
await gitPush(repositoryUrl, '1.1.x', {cwd});
await gitPush(repositoryUrl, '1.0.x', {cwd});
await gitCheckout('1.x.x', true, {cwd});
await gitCommits(['Third'], {cwd});
await gitPush(repositoryUrl, '1.x.x', {cwd});
Expand All @@ -30,7 +30,7 @@ test('Expand branches defined with globs', async t => {

const branches = [
// Should match all maintenance type branches
{name: '+([1-9])?(.{+([1-9]),x}).x'},
{name: '+([0-9])?(.{+([0-9]),x}).x'},
{name: 'master', channel: 'latest'},
{name: 'next'},
{name: 'pre/{foo,bar}', channel: `\${name.replace(/^pre\\//g, '')}`, prerelease: true},
Expand All @@ -42,7 +42,7 @@ test('Expand branches defined with globs', async t => {
];

t.deepEqual(await expand({cwd}, branches), [
{name: '1.1.x'},
{name: '1.0.x'},
{name: '1.x.x'},
{name: '2.x'},
{name: 'master', channel: 'latest'},
Expand Down
6 changes: 3 additions & 3 deletions test/get-config.test.js
Expand Up @@ -36,7 +36,7 @@ test('Default values, reading repositoryUrl from package.json', async t => {

// Verify the default options are set
t.deepEqual(result.branches, [
'+([1-9])?(.{+([1-9]),x}).x',
'+([0-9])?(.{+([0-9]),x}).x',
'master',
'next',
'next-major',
Expand All @@ -57,7 +57,7 @@ test('Default values, reading repositoryUrl from repo if not set in package.json

// Verify the default options are set
t.deepEqual(result.branches, [
'+([1-9])?(.{+([1-9]),x}).x',
'+([0-9])?(.{+([0-9]),x}).x',
'master',
'next',
'next-major',
Expand All @@ -79,7 +79,7 @@ test('Default values, reading repositoryUrl (http url) from package.json if not

// Verify the default options are set
t.deepEqual(result.branches, [
'+([1-9])?(.{+([1-9]),x}).x',
'+([0-9])?(.{+([0-9]),x}).x',
'master',
'next',
'next-major',
Expand Down

0 comments on commit a022996

Please sign in to comment.