semantic-release 17.3.9 → 17.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -48,7 +48,7 @@ This removes the immediate connection between human emotions and version numbers
48
48
 
49
49
  **semantic-release** uses the commit messages to determine the type of changes in the codebase. Following formalized conventions for commit messages, **semantic-release** automatically determines the next [semantic version](https://semver.org) number, generates a changelog and publishes the release.
50
50
 
51
- By default **semantic-release** uses [Angular Commit Message Conventions](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines). The commit message format can be changed with the [`preset` or `config` options](docs/usage/configuration.md#options) of the [@semantic-release/commit-analyzer](https://github.com/semantic-release/commit-analyzer#options) and [@semantic-release/release-notes-generator](https://github.com/semantic-release/release-notes-generator#options) plugins.
51
+ By default **semantic-release** uses [Angular Commit Message Conventions](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-format). The commit message format can be changed with the [`preset` or `config` options](docs/usage/configuration.md#options) of the [@semantic-release/commit-analyzer](https://github.com/semantic-release/commit-analyzer#options) and [@semantic-release/release-notes-generator](https://github.com/semantic-release/release-notes-generator#options) plugins.
52
52
 
53
53
  Tools such as [commitizen](https://github.com/commitizen/cz-cli) or [commitlint](https://github.com/conventional-changelog/commitlint) can be used to help contributors and enforce valid commit messages.
54
54
 
package/docs/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # semantic-release documentation
2
2
 
3
3
  - [Usage](usage/README.md) - **semantic-release** installation and configuration
4
- - [Extending](extending/README.md)- Extending **semantic-release** with plugins and shareable configurations
4
+ - [Extending](extending/README.md) - Extending **semantic-release** with plugins and shareable configurations
5
5
  - [Recipes](recipes/README.md) - Community written recipes for common **semantic-release** use-cases
6
6
  - [Developer Guide](developer-guide/README.md) - The essentials of writing a **semantic-release** plugin or shareable configurations
7
7
  - [Support](support/README.md) - FAQ and troubleshooting
@@ -1,14 +1,18 @@
1
1
  # Plugin Developer Guide
2
2
 
3
- To create a plugin for `semantic-release`, you need to decide which parts of the release lifecycle are important to that plugin. For example, it is best to always have a `verify` step because you may be receiving inputs from a user and want to make sure they exist. A plugin can abide by any of the following lifecycles:
3
+ To create a plugin for `semantic-release`, you need to decide which parts of the release lifecycle are important to that plugin. For example, it is best to always have a `verifyConditions` step because you may be receiving inputs from a user and want to make sure they exist. A plugin can abide by any of the following lifecycles:
4
4
 
5
- - `verify`
5
+ - `verifyConditions`
6
+ - `analyzeCommits`
7
+ - `verifyRelease`
8
+ - `generateNotes`
9
+ - `addChannel`
6
10
  - `prepare`
7
11
  - `publish`
8
12
  - `success`
9
13
  - `fail`
10
14
 
11
- `semantic-release` will require the plugin via `node` and look through the required object for methods named like the lifecyles stated above. For example, if your plugin only had a `verify` and `success` step, the `main` file for your object would need to `export` an object with `verify` and `success` functions.
15
+ `semantic-release` will require the plugin via `node` and look through the required object for methods named like the lifecyles stated above. For example, if your plugin only had a `verifyConditions` and `success` step, the `main` file for your object would need to `export` an object with `verifyConditions` and `success` functions.
12
16
 
13
17
  In addition to the lifecycle methods, each lifecyle is passed two objects:
14
18
 
@@ -93,7 +97,131 @@ if (message.length) {
93
97
  }
94
98
  ```
95
99
 
96
- ## Supporting Environment Variables
100
+ ## Context
101
+
102
+ ### Common context keys
103
+
104
+ * `stdout`
105
+ * `stderr`
106
+ * `logger`
107
+
108
+ ### Context object keys by lifecycle
109
+
110
+ #### verifyConditions
111
+
112
+ Initially the context object contains the following keys (`verifyConditions` lifecycle):
113
+ * `cwd`
114
+ * Current working directory
115
+ * `env`
116
+ * Environment variables
117
+ * `envCi`
118
+ * Information about CI environment
119
+ * Contains (at least) the following keys:
120
+ * `isCi`
121
+ * Boolean, true if the environment is a CI environment
122
+ * `commit`
123
+ * Commit hash
124
+ * `branch`
125
+ * Current branch
126
+ * `options`
127
+ * Options passed to `semantic-release` via CLI, configuration files etc.
128
+ * `branch`
129
+ * Information on the current branch
130
+ * Object keys:
131
+ * `channel`
132
+ * `tags`
133
+ * `type`
134
+ * `name`
135
+ * `range`
136
+ * `accept`
137
+ * `main`
138
+ * `branches`
139
+ * Information on branches
140
+ * List of branch objects (see above)
141
+
142
+ #### analyzeCommits
143
+
144
+ Compared to the verifyConditions, `analyzeCommits` lifecycle context has keys
145
+
146
+ * `commits` (List)
147
+ * List of commits taken into account when determining the new version.
148
+ * Keys:
149
+ * `commit` (Object)
150
+ * Keys:
151
+ * `long` (String, Commit hash)
152
+ * `short` (String, Commit hash)
153
+ * `tree` (Object)
154
+ * Keys:
155
+ * `long` (String, Commit hash)
156
+ * `short` (String, Commit hash)
157
+ * `author` (Object)
158
+ * Keys:
159
+ * `name` (String)
160
+ * `email` (String)
161
+ * `date` (String, ISO 8601 timestamp)
162
+ * `committer` (Object)
163
+ * Keys:
164
+ * `name` (String)
165
+ * `email` (String)
166
+ * `date` (String, ISO 8601 timestamp)
167
+ * `subject` (String, Commit message subject)
168
+ * `body` (String, Commit message body)
169
+ * `hash` (String, Commit hash)
170
+ * `committerDate` (String, ISO 8601 timestamp)
171
+ * `message` (String)
172
+ * `gitTags` (String, List of git tags)
173
+ * `releases` (List)
174
+ * `lastRelease` (Object)
175
+ * Keys
176
+ * `version` (String)
177
+ * `gitTag` (String)
178
+ * `channels` (List)
179
+ * `gitHead` (String, Commit hash)
180
+ * `name` (String)
181
+
182
+ #### verifyRelease
183
+
184
+ Additional keys:
185
+
186
+ * `nextRelease`
187
+ * Similar object as `lastRelease` (see above)
188
+
189
+ #### generateNotes
190
+
191
+ No new content in the context.
192
+
193
+ #### addChannel
194
+
195
+ *This is run only if there are releases that have been merged from a higher branch but not added on the channel of the current branch.*
196
+
197
+ Context content is similar to lifecycle `verifyRelease`.
198
+
199
+ #### prepare
200
+
201
+ Only change is that `generateNotes` has populated `nextRelease.notes`.
202
+
203
+ #### publish
204
+
205
+ No new content in the context.
206
+
207
+ #### success
208
+
209
+ Lifecycles `success` and `fail` are mutually exclusive, only one of them will be run.
210
+
211
+ Additional keys:
212
+
213
+ * `releases`
214
+ * Populated by `publish` lifecycle
215
+
216
+ #### fail
217
+
218
+ Lifecycles `success` and `fail` are mutually exclusive, only one of them will be run.
219
+
220
+ Additional keys:
221
+
222
+ * `errors`
223
+
224
+ ### Supporting Environment Variables
97
225
 
98
226
  Similar to `options`, environment variables exist to allow users to pass tokens and set special URLs. These are set on the `context` object instead of the `pluginConfig` object. Let's say we wanted to check for `GITHUB_TOKEN` in the environment because we want to post to GitHub on the user's behalf. To do this, we can add the following to our `verify` command:
99
227
 
@@ -101,6 +229,6 @@ Similar to `options`, environment variables exist to allow users to pass tokens
101
229
  const { env } = context;
102
230
 
103
231
  if (env.GITHUB_TOKEN) {
104
- //...
232
+ //...
105
233
  }
106
- ```
234
+ ```
@@ -20,7 +20,7 @@
20
20
  - `publish`: Publish the package on the npm registry
21
21
  - [@semantic-release/gitlab](https://github.com/semantic-release/gitlab)
22
22
  - `verifyConditions`: Verify the presence and the validity of the GitLab authentication and release configuration
23
- - `publish`: Publish a [GitLab release](https://docs.gitlab.com/ce/workflow/releases.html)
23
+ - `publish`: Publish a [GitLab release](https://docs.gitlab.com/ee/user/project/releases/)
24
24
  - [@semantic-release/git](https://github.com/semantic-release/git)
25
25
  - `verifyConditions`: Verify the presence and the validity of the Git authentication and release configuration
26
26
  - `prepare`: Push a release commit and tag, including configurable files
@@ -97,7 +97,7 @@ The Git history of the repository is now:
97
97
 
98
98
  After a period of feedback from our users using the `@next` dist-tag we feel confident to make our big feature available to all users. To do so we merge the `next` branch into `master`. There should be no conflict as `next` is strictly ahead of `master`.
99
99
 
100
- Once the merge commit is pushed to `next`, **semantic-release** will add the version `2.1.0` to the dist-tag `@latest` so all users will receive it when installing out module with `npm install example-module`.
100
+ Once the merge commit is pushed to `master`, **semantic-release** will add the version `2.1.0` to the dist-tag `@latest` so all users will receive it when installing out module with `npm install example-module`.
101
101
 
102
102
  The Git history of the repository is now:
103
103
 
@@ -25,7 +25,7 @@ on:
25
25
  jobs:
26
26
  release:
27
27
  name: Release
28
- runs-on: ubuntu-18.04
28
+ runs-on: ubuntu-latest
29
29
  steps:
30
30
  - name: Checkout
31
31
  uses: actions/checkout@v2
@@ -15,6 +15,7 @@
15
15
  - ["Introduction to SemVer" - Irina Gebauer](https://blog.greenkeeper.io/introduction-to-semver-d272990c44f2)
16
16
  - ["Introduction to Semantic Release" - liv](https://blog.greenkeeper.io/introduction-to-semantic-release-33f73b117c8)
17
17
  - ["Series - Semantic Release Automation" - Abdelrahman Wahdan](https://dev.to/abdelrahmanahmed/semantic-release-and-how-to-automate-it-part-1-4pa2)
18
+ - ["Explain semantic release and how to use it on GitLab pipeline"](https://regoo707.medium.com/auto-bump-apps-versions-and-releases-using-gitlab-pipeline-e32f1d7fa3ee)
18
19
 
19
20
  ## Tutorials
20
21
 
@@ -65,5 +65,5 @@ To recover from that situation, do the following:
65
65
 
66
66
  1. Delete the tag(s) for the release(s) that have been lost from the git history. You can delete each tag from remote using `git push origin :[TAG NAME]`, e.g. `git push origin :v2.0.0-beta.1`. You can delete tags locally using `git tag -d [TAG NAME]`, e.g. `git tag -d v2.0.0-beta.1`.
67
67
  2. Re-create the tags locally: `git tag [TAG NAME] [COMMIT HASH]`, where `[COMMIT HASH]` is the new commit that created the release for the lost tag. E.g. `git tag v2.0.0-beta.1 abcdef0`
68
- 3. Re-create the git notes for each release tag, e.g. `git notes --ref semantic-release add -f -m '{"channels":["beta"]}' v3.0.0-beta.1`. If the release was also published in the default channel (usually `master`), then set the first channel to `null`, e.g. `git notes --ref semantic-release add -f -m '{"channels":[null, "beta"]}'
68
+ 3. Re-create the git notes for each release tag, e.g. `git notes --ref semantic-release add -f -m '{"channels":["beta"]}' v2.0.0-beta.1`. If the release was also published in the default channel (usually `master`), then set the first channel to `null`, e.g. `git notes --ref semantic-release add -f -m '{"channels":[null, "beta"]}'
69
69
  4. Push the local notes: `git push --force origin refs/notes/semantic-release`. The `--force` is needed after the rebase. Be careful.
package/lib/get-config.js CHANGED
@@ -9,19 +9,10 @@ const plugins = require('./plugins');
9
9
  const {validatePlugin, parseConfig} = require('./plugins/utils');
10
10
 
11
11
  const CONFIG_NAME = 'release';
12
- const CONFIG_FILES = [
13
- 'package.json',
14
- `.${CONFIG_NAME}rc`,
15
- `.${CONFIG_NAME}rc.json`,
16
- `.${CONFIG_NAME}rc.yaml`,
17
- `.${CONFIG_NAME}rc.yml`,
18
- `.${CONFIG_NAME}rc.js`,
19
- `${CONFIG_NAME}.config.js`,
20
- ];
21
12
 
22
13
  module.exports = async (context, cliOptions) => {
23
14
  const {cwd, env} = context;
24
- const {config, filepath} = (await cosmiconfig(CONFIG_NAME, {searchPlaces: CONFIG_FILES}).search(cwd)) || {};
15
+ const {config, filepath} = (await cosmiconfig(CONFIG_NAME).search(cwd)) || {};
25
16
 
26
17
  debug('load config from: %s', filepath);
27
18
 
package/lib/git.js CHANGED
@@ -318,7 +318,7 @@ async function getNote(ref, execaOptions) {
318
318
  }
319
319
 
320
320
  /**
321
- * Get and parse the JSON note of a given reference.
321
+ * Add JSON note to a given reference.
322
322
  *
323
323
  * @param {Object} note The object to save in the reference note.
324
324
  * @param {String} ref The Git reference to add the note to.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "semantic-release",
3
3
  "description": "Automated semver compliant package publishing",
4
- "version": "17.3.9",
4
+ "version": "17.4.3",
5
5
  "author": "Stephan Bönnemann <stephan@boennemann.me> (http://boennemann.me)",
6
6
  "ava": {
7
7
  "files": [
@@ -35,10 +35,10 @@
35
35
  "get-stream": "^6.0.0",
36
36
  "git-log-parser": "^1.2.0",
37
37
  "hook-std": "^2.0.0",
38
- "hosted-git-info": "^3.0.0",
39
- "lodash": "^4.17.15",
38
+ "hosted-git-info": "^4.0.0",
39
+ "lodash": "^4.17.21",
40
40
  "marked": "^2.0.0",
41
- "marked-terminal": "^4.0.0",
41
+ "marked-terminal": "^4.1.1",
42
42
  "micromatch": "^4.0.2",
43
43
  "p-each-series": "^2.1.0",
44
44
  "p-reduce": "^2.0.0",
@@ -57,12 +57,12 @@
57
57
  "dockerode": "3.2.1",
58
58
  "file-url": "3.0.0",
59
59
  "fs-extra": "9.1.0",
60
- "got": "11.8.1",
61
- "js-yaml": "3.14.0",
60
+ "got": "11.8.2",
61
+ "js-yaml": "3.14.1",
62
62
  "mockserver-client": "5.11.2",
63
- "nock": "13.0.7",
63
+ "nock": "13.0.11",
64
64
  "nyc": "15.1.0",
65
- "p-retry": "4.3.0",
65
+ "p-retry": "4.5.0",
66
66
  "proxyquire": "2.1.3",
67
67
  "sinon": "9.2.4",
68
68
  "stream-buffers": "3.0.2",