Commit Graph
100 Commits
Author SHA1 Message Date
Pierre VanduynslagerandGregor Martynus 5f1d530e2a feat: allow to use shorthand for repositoryUrl
- `owner/repo` => `https://github.com/owner/repo.git`
- `gitlab:owner/repo` => `https://gitlab.com/owner/repo.git`
- `bitbucket:owner/repo` => `https://bitbucket.com/owner/repo.git`
2018-03-15 22:40:09 +00:00
Pierre VanduynslagerandGregor Martynus b0b4fc82de fix: convert git+https URL in package.json to https 2018-03-13 00:54:32 +00:00
Pierre VanduynslagerandGregor Martynus 6f74dcbd4a fix: use correct debug namespace 2018-03-13 00:54:32 +00:00
Pierre VanduynslagerandGregor Martynus e4618a2fbc fix: exclude prereleases from version retrived by getLastRelease 2018-03-08 17:25:40 +00:00
Pierre VanduynslagerandGregor Martynus e5a73d8628 fix: remove unecessary console.log 2018-03-07 23:01:08 +00:00
Pierre Vanduynslager c2beb643fa feat: add the prepare plugin hook
BREAKING CHANGE: Committing or creating files in the `publish` plugin hook is not supported anymore and now must be done in the `prepare` hook

Plugins with a `publish` hook that makes a commit or create a file that can be committed must use the `prepare` hook.
2018-02-19 00:28:50 -05:00
Pierre Vanduynslager 20246c02b1 fix: exclude empty env var value from replacement 2018-02-19 00:01:06 -05:00
Pierre Vanduynslager 857d4180e9 fix: allow boolean option to be set in config file 2018-02-16 00:51:58 -05:00
Pierre Vanduynslager 4d0490122c style: lint 2018-02-15 23:19:57 -05:00
Pierre Vanduynslager aa724e80f7 chore(package): simplify xo configuration 2018-02-15 23:19:57 -05:00
Pierre VanduynslagerandGregor Martynus 1966f0e3e2 fix: verify branch first 2018-02-15 18:35:37 +00:00
Pierre Vanduynslager 305f4ee8eb fix: do not transform repositoryUrl if it allow to push
Even the user set Git credentials via environment variable, use the configured URL (with authentication) if it works.
This allow users to push tags and commits via ssh while still using the GitHub/GitLab API.
2018-02-14 10:45:44 -05:00
Pierre Vanduynslager 9788fcad4e feat: use @semantic-release/github as default for success and fail hooks
BREAKING CHANGE: `success` and `fail` hooks are now enabled by default

In order to disable the `@semantic-release/github` plugin for the `success` and `fail` hook, the corresponding options have to be set to `false` in the **semantic-release** configuration:

```json
{
  "release": {
    "success": false,
    "fail": false
  }
}
```

Users who do not use the `@semantic-release/github` plugin, should disable it in the `success` and `fail` by setting the corresponding options to `false` or to alternative plugin providing `success` and `fail` hooks.
2018-02-13 16:33:37 -05:00
Pierre Vanduynslager 04f3061bed fix: remove the github plugin from default success and fail hooks 2018-02-13 16:06:30 -05:00
Pierre Vanduynslager 1b3c51d624 docs: add missing success and fail options 2018-02-13 16:06:30 -05:00
Pierre Vanduynslager 8a2ef48308 test: revert to mockserver:latest docker container 2018-02-12 21:40:47 -05:00
Pierre Vanduynslager ce1e74f611 fix: set repository authentication when repositoryUrl is set as an option 2018-02-12 16:17:09 -05:00
Pierre Vanduynslager b6837a20a8 test: use older version of mockserver
Due to https://github.com/jamesdbloom/mockserver/issues/435
2018-02-12 16:17:09 -05:00
Pierre VanduynslagerandGregor Martynus 97cb354fea feat: improve CLI
- Replace `commander.js` with `yargs`
- Add CLI unit tests
- Add a `--version` option
- Improve `--help` output
- Remove `commander.js` related workaround
- Allow to set list option with arg repetition or space separated list
- Maintain the list options defined as comma separated list
2018-02-12 11:01:09 -08:00
Pierre VanduynslagerandGregor Martynus f92677b092 fix: log current version of semantic-release 2018-02-12 11:01:09 -08:00
Pierre Vanduynslager 9dd127ba98 fix: fix EPLUGINCONF error details 2018-02-12 00:36:06 -05:00
Pierre Vanduynslager c9bd5de075 docs: simplify GitLAb-ci config
- remove Node 4
2018-02-11 22:17:12 -05:00
Pierre Vanduynslager 51f6e5fd60 docs: simplify travis config
- remove OSs
- remove Node 4
2018-02-11 22:17:12 -05:00
Pierre Vanduynslager c6e95b0885 docs: add CircleCI workflows recipe 2018-02-11 22:17:12 -05:00
Pierre Vanduynslager 7fbd2721c4 docs: add Travis Build Stages recipe 2018-02-11 22:17:12 -05:00
Pierre Vanduynslager fcb64e6fef docs: remove unnecessary script override in travis recipe 2018-02-11 22:17:12 -05:00
Pierre Vanduynslager d72cfc2546 docs: fix typo in travis recipe 2018-02-11 22:17:12 -05:00
Pierre Vanduynslager 49f5e704ba feat: add success and fail notification plugins
- Allow `publish` plugins to return an `Object` with information related to the releases
- Add the `success` plugin hook, called when all `publish` are successful, receiving a list of release
- Add the `fail` plugin hook, called when an error happens at any point, receiving a list of errors
- Add detailed message for each error
2018-02-11 19:53:41 -05:00
Pierre Vanduynslager 9b2f6bfed2 feat: allow plugins to throw an iterable list of errors 2018-02-11 19:53:41 -05:00
Pierre Vanduynslager 9360caf253 docs: fix minor typo in FAQ 2018-02-10 23:38:12 -05:00
Pierre Vanduynslager 5fd990acef docs: fix typo in extending link 2018-02-09 18:43:56 -05:00
Pierre Vanduynslager 687435b9a2 feat: add debug logs for git commands 2018-02-08 16:43:17 -05:00
Pierre Vanduynslager 7e785fa757 fix: debug log all options 2018-02-08 16:13:04 -05:00
Pierre Vanduynslager 053c9edf9b test: add test to parse GitLab/Bitbucket URLs with groups 2018-02-07 21:03:36 -05:00
Pierre Vanduynslager 2edd9da598 fix(package): update git-url-parse to version 8.1.0 2018-02-07 21:03:36 -05:00
Pierre Vanduynslager cbf57851fb fix: always transform git+https url to https 2018-02-02 15:33:36 -05:00
Pierre VanduynslagerandGitHub af8c830335 fix(package): update @semantic-release/github to version 4.0.2 2018-02-02 13:55:21 -05:00
Pierre Vanduynslager 39536fa34e feat: add tagFormat option to customize Git tag name 2018-01-29 00:55:32 -05:00
Pierre Vanduynslager faabffb208 fix: log all core verification errors 2018-01-29 00:55:32 -05:00
Pierre Vanduynslager 467635bc14 fix: prioritize GIT_CREDENTIALS for gtit credentials
Allow to defined a both `GIT_CREDENTIALS` for repository access and `GH_TOKEN` or `GL_TOKEN` for API access
2018-01-27 20:31:59 -05:00
Pierre Vanduynslager 8b3605dd04 fix: hide sensitive info for Buffer and undefined 2018-01-27 18:24:24 -05:00
Pierre Vanduynslager cb36dd4890 fix: rename the --repositoryUrl CLI option to --repository-url
Harmonize the CLI option format.

BREAKING CHANGE: The `--repositoryUrl` CLI options is replaced by `--repository-url`
2018-01-27 16:50:29 -05:00
Pierre Vanduynslager d0b304e240 feat: get last release with git tags
- Remove the `getLastRelease` plugin type
- Retrieve the last release based on Git tags
- Create the next release Git tag before calling the `publish` plugins

BREAKING CHANGE: Remove the `getLastRelease` plugin type

The `getLastRelease` plugins will not be called anymore.

BREAKING CHANGE: Git repository authentication is now mandatory

The Git authentication is now mandatory and must be set via `GH_TOKEN`, `GITHUB_TOKEN`,  `GL_TOKEN`, `GITLAB_TOKEN` or `GIT_CREDENTIALS` as described in [CI configuration](https://github.com/semantic-release/semantic-release/blob/caribou/docs/usage/ci-configuration.md#authentication).
2018-01-27 16:50:29 -05:00
Pierre Vanduynslager fb0caa005b feat: hide sensitive info in stdout/sdtin 2018-01-27 14:00:06 -05:00
Pierre Vanduynslager cdb98f919f feat: log all verification errors 2018-01-27 13:24:39 -05:00
Pierre VanduynslagerandGregor Martynus 0d2d1f2376 fix: fix the --no-ci arg parsing
The `noCi` is no properly set based on the `--no-ci` CLI arg and it is overwritten by the `noCi` option
2018-01-24 22:22:16 -08:00
Pierre VanduynslagerandGregor Martynus 7e860c7915 docs(travis): recommend to use the deploy step instead of script
The `script` step can be used with Build Stage if `semantic-release` is the only `script` ran in the `release` stage.

See https://github.com/travis-ci/travis-ci/issues/1066
2018-01-21 15:00:05 -08:00
Pierre VanduynslagerandGregor Martynus e0fa20b8a0 ci(travis): use Build Stages 2018-01-21 15:00:05 -08:00
Pierre Vanduynslager fa2ca8a34b fix(package): update lodash to version 4.17.4 2018-01-20 17:23:45 -05:00
Pierre VanduynslagerandGregor Martynus cc0c312a9d fix: set node minimum version to 8.3
The minimum Node version supported is 8.3 as we use Object properties spread.
2018-01-13 12:49:19 -08:00
Pierre Vanduynslager 49ad198e35 docs(contrib): add atomic commits requirement 2018-01-07 20:48:19 -05:00
Pierre Vanduynslager adbcca6c52 docs: add issue template 2018-01-06 19:21:00 -05:00
Pierre Vanduynslager e0b4e6ac78 docs: add CONTRIBUTING guidelines 2018-01-06 19:21:00 -05:00
Pierre Vanduynslager 53f3de6786 feat: allow to exclude commits from analysis 2018-01-06 00:11:20 -05:00
Pierre Vanduynslager fd54eead6f docs: update Yarn FAQ 2018-01-05 23:10:49 -05:00
Pierre Vanduynslager ba79c8590a docs: typos. clarifications 2018-01-05 18:58:22 -05:00
Pierre Vanduynslager 75778bcea4 docs: troubleshooting 2018-01-05 18:58:22 -05:00
Pierre Vanduynslager d6c398fd8b docs: add heading anchor 2018-01-05 18:58:22 -05:00
Pierre Vanduynslager fdb995f77d docs: publish with gitbook 2018-01-05 16:05:30 -05:00
Pierre Vanduynslager ed89361d7c docs: documentation improvements
**Refactor and clarify the documentation in `README.md`**
- Add Highlights
- Add a Table of contents
- Clarify the way semantic-release works
- Clarify relationship with the CI environments
- Describe local install for Node projects (with a `package.json`) and global install for non-JavaScript projects
- Explain CI general configuration (environment variables and a run after all jobs are successful)
- Clarify configuration (via config file or CLI arguments)
- Clarify plugin roles and configuration
- Add doc for shareable configuration
- Add recipes
- Add resources (Videos, articles, tutorials)
- Add a Support section
- Add a Team section

**Add the following FAQs**
- How can I use a npm build script that requires the `package.json`’s version ?
- Can I use Semantic-release with Yarn?
- Can I use Semantic-release to publish non-JavaScript packages?
- Can I use Semantic-release with any CI service?
- Can I use Semantic-release with any GitLab?
- Can I use Semantic-release with any Git hosted environment?
- Can I skip the release to the npm registry?
- Can I use .npmrc options?
- How can I set the access level of the published npm package?
- Can I use Semantic-release to publish a package on Artifactory?
- Can I set the initial release version of my package to 0.0.1?
- Why does semantic-release require Node version >= 8?

**Clarify Nove 8 requirement and solutions**
- Add Node version requirement explanation and solutions
- [X] Display a link to the documentation when running on Node < 8 version

**Add recipes**
- Travis
- GitLab CI
- Travis with build stages - To be done in #573
- CircleCI workflows - To be done in #573
2018-01-05 16:05:30 -05:00
Pierre Vanduynslager 5bc46a08cf feat: allow to release from local machine 2018-01-02 14:31:43 -05:00
Pierre Vanduynslager 5cc62e49ee test: add missing mockserver mocks 2018-01-01 20:20:19 -05:00
Pierre Vanduynslager 95de6a5c80 test: update test for @semantic-release/github@3.0.1 2018-01-01 20:20:19 -05:00
Pierre Vanduynslager 3c80fd2bf1 docs: update badges
Include npm version badges for both `@latest` and `@next` dist-tag
2017-12-31 00:39:27 -05:00
Pierre Vanduynslager e145134a62 ci: fix travis-deploy-once install cmd 2017-12-31 00:08:21 -05:00
Pierre Vanduynslager 8d575654c2 feat: make semantic-release CI agnostic
- Remove `@semantic-release/condition-travis` from the default plugins
- Verify the current branch in the core
- Verify the build is not triggered by a PR in the core
- Run in dry-run mode if not triggered on CI
- Dry-run mode runs the `verifyConditions` plugins, allowing to detect configuration error locally
- Return without error when no version has to be released due to no changes
- Return without error if the build is triggered from a PR
- Return without error if the current branch is not the configured branch
- CLI return with exit code 1 if there is a `semanticReleaseError`, allowing to fail builds in case of config error, missing token etc...

BREAKING CHANGE: `semantic-release` doesn't make sure it runs only on one Travis job anymore.
The CI configuration has to be done such that `semantic-release`
- runs only once per build
- runs only after all tests are successful on every jobs of the build
- runs on Node >=8

This can easily be done with [travis-deploy-once](https://github.com/semantic-release/travis-deploy-once).

Migration Guide

Modify your `.travis.yml` to use `travis-deploy-once`.
Replace:
```yaml
after_success:
  - npm run semantic-release
```
by:
Replace
```yaml
after_success:
  - npm install -g travis-deploy-once@4
  - travis-deploy-once "npm run semantic-release"
```
2017-12-30 23:15:25 -05:00
Pierre Vanduynslager 996305d69c feat: move npm workaround for missing gitHead to the npm plugin 2017-12-30 21:17:04 -05:00
Pierre Vanduynslager 754b420fd6 feat: support sharable configuration
Adds the options `extends`, which can be defined via configuration file or CLI arguments to a single path or an array of paths of shareable configuration.
A shareable configuration is a file or a module that can be loaded with `require`.
Options is defined by merging in the following order of priority:
- CLI/API
- Configuration file
- Shareable configuration (from right to left)

Options set in a shareable configuration can be unset by setting it to `null` or `undefined` in the main configuration file. If a default value applies to this property it will be used.
2017-12-22 14:22:30 -05:00
Pierre Vanduynslager 2fc538b607 test: add test for missing custom plugin modules 2017-12-22 14:22:30 -05:00
Pierre Vanduynslager f707b1a90a feat: allow to define plugin options globally 2017-12-22 14:22:30 -05:00
Pierre Vanduynslager 3316f1a79e test: add a delay after starting the npm registry
Attempt at improving test reliability on CI
2017-12-14 11:44:24 -05:00
Pierre Vanduynslager 8942093c18 test: limit information stored in context
Store only objects set in `beforeEach` used in `test`.
Avoid logging useless info on test failure.
2017-12-14 11:44:24 -05:00
Pierre Vanduynslager 4053d8f7fb fix: log plugin type in addition of path 2017-12-10 04:03:32 -05:00
Pierre Vanduynslager 0761ef378a style: update to prettier@1.9.0 2017-12-05 10:03:18 -05:00
Pierre Vanduynslager eec4e68615 test: Isolate environment variables passed to semantic-release
`npm` is called through `semantic-release` and in the integration test to make some assertion.
By isolating the the environment variables passed to `semantic-release` it's easier to avoid a mistake that would pass the test environment that contains is own auth variables.
2017-11-29 18:06:14 -05:00
Pierre Vanduynslager 8371a03da0 test: Verify Error instance type and SemanticReleaseError name 2017-11-29 18:06:14 -05:00
Pierre Vanduynslager 2491032a99 test: Add test to check unexpected plugin return values 2017-11-29 18:06:14 -05:00
Pierre Vanduynslager 02ddf34f21 Fix: Remove redundant test of commitAnalyzer plugin output 2017-11-29 18:06:14 -05:00
Pierre Vanduynslager 685959107b chore: Clean up mistakenly added configs 2017-11-29 18:06:14 -05:00
Pierre Vanduynslager 613a646363 fix: Typo in error messages 2017-11-29 18:06:14 -05:00
Pierre Vanduynslager d7b323dd00 fix: Accept undefined values for the getLastRelease and generateNotes plugins
Adapt tests and default value to the plugin definitions (`definitions.js`)
2017-11-29 18:06:14 -05:00
Pierre Vanduynslager a7359bffb6 test: Improve docker start/stop script
- Simplify the loop that check availability
- Increase timeout
- Remove the container after stopping
2017-11-29 18:06:14 -05:00
Pierre Vanduynslager fcb832bbe1 fix: remove name from log as it's not an existing option anymore 2017-11-29 18:06:14 -05:00
Pierre Vanduynslager ce3841f553 test: Ignore the ~/.npmrc file during tests
When the test are run npm read the ~/.npmrc and ./.npmrc files and set some environment variables starting with `npm_`.
When the test create temporary folders and created a `.npmrc` the values there are ignored as the environment variables take precedence.
This commit remove this environment variable (from the local `process.env`) before starting the integrations test and restore them after. This way the `./.npmrc` files created in temp directory for the test are correctly used.
2017-11-25 14:50:44 -05:00
Pierre Vanduynslager 40c58c9b42 ci: Run npm registry in Docker 2017-11-25 14:50:44 -05:00
Pierre Vanduynslager 0c67ba517f feat: Make semantic-release language agnostic
- Do not rely on `package.json` anymore
- Use `cosmiconfig` to load the configation. `semantic-release` can be configured:
  - via CLI options (including plugin names but not plugin options)
  - in the `release` property of `package.json` (as before)
  - in a `.releaserc.yml` or `.releaserc.js` or `.releaserc.js` or `release.config.js` file
  - in a `.releaserc` file containing `json`, `yaml` or `javascript` module
- Add the `repositoryUrl` options (used across `semantic-release` and plugins). The value is determined from CLi option, or option configuration, or package.json or the git remote url
- Verifies that `semantic-release` runs from a git repository
- `pkg` and `env` are not passed to plugin anymore
- `semantic-release` can be run both locally and globally. If ran globally with non default plugins, the plugins can be installed both globally or locally.

BREAKING CHANGE: `pkg` and `env` are not passed to plugin anymore.
Plugins relying on a `package.json` must verify the presence of a valid `package.json` and load it.
Plugins can use `process.env` instead of `env`.
2017-11-24 21:56:15 -05:00
Pierre Vanduynslager 5bec59b26b feat: Expect plugins to return Promises
BREAKING CHANGE: Each plugin is expected to return an async function or a Promise returning function. The callback parameter is not passed to plugins anymore.
2017-11-24 21:56:15 -05:00
Pierre Vanduynslager d4c7605f68 fix: Use default plugin if the path property is missing from a single plugin configuration 2017-11-22 19:47:09 -05:00
Pierre Vanduynslager facdadaddb ci: Lint with XO 2017-11-21 20:55:47 -05:00
Pierre Vanduynslager d548edcf37 feat: Extract npm and github publish to plugins
- Add a new plugin type: `publish`
- Add support for multi-plugin. A plugin module can now return an object with a property for each plugin type
- Uses by default [npm](https://github.com/semantic-release/npm) and [github](https://github.com/semantic-release/github) in addition of Travis for the verify condition plugin
- Uses by default [npm](https://github.com/semantic-release/npm) and [github](https://github.com/semantic-release/github) for the publish plugin
- `gitTag` if one can be found is passed to `generateNotes` for both `lastRelease` and `nextRelease`
- `semantic-release` now verifies the plugin configuration (in the `release` property of `package.json`) and throws an error if it's invalid
- `semantic-release` now verifies each plugin output and will throw an error if a plugin returns an unexpected value.

BREAKING CHANGE: `githubToken`, `githubUrl` and `githubApiPathPrefix` have to be set at the [github](https://github.com/semantic-release/github) plugin level. They can be set via `GH_TOKEN`, `GH_URL` and `GH_PREFIX` environment variables.

BREAKING CHANGE: the `npm` parameter is not passed to any plugin anymore. Each plugin have to read `.npmrc` if they needs to (with https://github.com/kevva/npm-conf for example).
2017-11-21 16:41:04 -05:00
Pierre Vanduynslager 991a7b5f97 refactor: Simplify file tree 2017-11-21 16:41:04 -05:00
Pierre Vanduynslager 17a600672f style: Update style for Prettier 1.8.0 2017-11-07 00:34:16 -05:00
Pierre VanduynslagerandGregor Martynus d0180c4348 feat: Additional commit information
Add `author`, `commiter`, `gitTags` and `committerDate` to the commit object passed to plugin
2017-10-29 20:01:16 -07:00
Pierre VanduynslagerandGregor Martynus c90765e10d fix: Include Error properties in logs 2017-10-29 14:37:05 -07:00
Pierre VanduynslagerandGregor Martynus ad2e1d76b7 test: Fix typos: only in tests and useless console.log() 2017-10-29 14:37:05 -07:00
Pierre VanduynslagerandGregor Martynus 65d344bae8 fix: Check SemanticReleaseError by error.semanticRelease property 2017-10-29 14:37:05 -07:00
Pierre-Denis VanduynslagerandGregor Martynus e2a8a5cd32 feat: Refactor CLI to run with one command, improve logs, modularize, add tests
- Run with one command and do not rely on error exit codes to stop the process when a release is not necessary
- Break `index.js` in smaller modules in order to improve testability and simplify the code
- Add several missing unit and integration tests to reach 100% coverage
- Integration tests now test end to end, including publishing to Github (with http://www.mock-server.com on Docker)
- Use `tj/commander.js` to print an help message, verify and parse CLI arguments
- Semantic-release can now be called via Javascript API: `require('semantic-release')(options)`
- Remove npmlog dependency and add more log messages
- Logger is now passed to plugins
- Add debug logs with `visionmedia/debug`. `debug` is enabled for both semantic-release and plugins with `--debug`
- Use `kevva/npm-conf` in place of the deprecated `npm/npmconf`
- Pass lastRelease, nextRelease and commits to generate-notes plugin
- In dry-run mode, print the release note instead of publishing it to Github as draft, and skip the CI verifications
- The dry-run mode does not require npm and Github TOKEN to be set anymore and can be run locally

BREAKING CHANGE: Semantic-Release must now be executed with `semantic-release` instead of `semantic-release pre && npm publish && semantic-release post`.
BREAKING CHANGE: The `semantic-release` command now returns with exit code 0 on expected exception (no release has to be done, running on a PR, gitHead not found, other CI job failed etc...). It only returns with 1 when there is an unexpected error (code error in a plugin, plugin not found, git command cannot be run etc..).
BREAKING CHANGE: Calling the `semantic-release` command with unexpected argument(s) now exit with 1 and print an help message.
BREAKING CHANGE: Semantic-Release does not rely on `npmlog` anymore and the log level cannot be configured. Debug logs can be activated with CLI option `--debug` or with environment variable `DEBUG=semantic-release:*`
BREAKING CHANGE: The CLI options `--debug` doesn't enable the dry-run mode anymore but activate the debugs. The dry run mode is now set with the CLI command `--dry-run` or `-d`.
2017-10-27 18:07:13 -07:00
Pierre-Denis VanduynslagerandGregor Martynus b0bc49063b fix: handle errors when verifyConditions and verifyRelease are a pipeline 2017-10-18 14:00:20 -07:00
Pierre-Denis VanduynslagerandGregor Martynus 580ad9c3d2 feat: Allow to recover from ENOTINHISTORY with a tag and handle detached head repo
- Tag sha will now be used also if there is a gitHead in last release and it's not in the history
- Use `git merge-base` to determine if a commit is in history, allowing to use CI creating detached head repo
- Mention recovery solution by creating a version tag in `ENOTINHISTORY` and `ENOGITHEAD` error messages
- Do not mention branches containing missing commit in `ENOTINHISTORY` and `ENOGITHEAD` error messages as it's not available by default on most CI
2017-10-11 20:54:10 -07:00
Pierre-Denis VanduynslagerandGregor Martynus 8e9d9f77f3 fix: Always pass pluginConfig to plugins as a defined object 2017-10-06 10:28:37 -07:00