@semantic-release/github 7.1.2 → 7.2.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
@@ -3,9 +3,7 @@
3
3
  [**semantic-release**](https://github.com/semantic-release/semantic-release) plugin to publish a
4
4
  [GitHub release](https://help.github.com/articles/about-releases) and comment on released Pull Requests/Issues.
5
5
 
6
- [![Travis](https://img.shields.io/travis/semantic-release/github.svg)](https://travis-ci.org/semantic-release/github)
7
- [![Codecov](https://img.shields.io/codecov/c/github/semantic-release/github.svg)](https://codecov.io/gh/semantic-release/github)
8
- [![Greenkeeper badge](https://badges.greenkeeper.io/semantic-release/github.svg)](https://greenkeeper.io/)
6
+ [![Build Status](https://github.com/semantic-release/github/workflows/Test/badge.svg)](https://github.com/semantic-release/github/actions?query=workflow%3ATest+branch%3Amaster)
9
7
 
10
8
  [![npm latest version](https://img.shields.io/npm/v/@semantic-release/github/latest.svg)](https://www.npmjs.com/package/@semantic-release/github)
11
9
  [![npm next version](https://img.shields.io/npm/v/@semantic-release/github/next.svg)](https://www.npmjs.com/package/@semantic-release/github)
@@ -76,7 +74,7 @@ If you have actions that trigger on newly created releases, please use a generat
76
74
  |-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|
77
75
  | `githubUrl` | The GitHub Enterprise endpoint. | `GH_URL` or `GITHUB_URL` environment variable. |
78
76
  | `githubApiPathPrefix` | The GitHub Enterprise API prefix. | `GH_PREFIX` or `GITHUB_PREFIX` environment variable. |
79
- | `proxy` | The proxy to use to access the GitHub API. See [proxy](#proxy). | `HTTP_PROXY` environment variable. |
77
+ | `proxy` | The proxy to use to access the GitHub API. Set to `false` to disable usage of proxy. See [proxy](#proxy). | `HTTP_PROXY` environment variable. |
80
78
  | `assets` | An array of files to upload to the release. See [assets](#assets). | - |
81
79
  | `successComment` | The comment to add to each issue and pull request resolved by the release. Set to `false` to disable commenting on issues and pull requests. See [successComment](#successcomment). | `:tada: This issue has been resolved in version ${nextRelease.version} :tada:\n\nThe release is available on [GitHub release](<github_release_url>)` |
82
80
  | `failComment` | The content of the issue created when a release fails. Set to `false` to disable opening an issue when a release fails. See [failComment](#failcomment). | Friendly message with links to **semantic-release** documentation and support, with the list of errors that caused the release to fail. |
@@ -88,7 +86,7 @@ If you have actions that trigger on newly created releases, please use a generat
88
86
 
89
87
  #### proxy
90
88
 
91
- Can be a the proxy URL or and `Object` with the following properties:
89
+ Can be `false`, a proxy URL or an `Object` with the following properties:
92
90
 
93
91
  | Property | Description | Default |
94
92
  |---------------|----------------------------------------------------------------|--------------------------------------|
@@ -19,9 +19,9 @@ module.exports = (branch, errors) => `## :rotating_light: The automated release
19
19
  branch.name
20
20
  }\` branch failed. :rotating_light:
21
21
 
22
- I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.
22
+ I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.
23
23
 
24
- You can find below the list of errors reported by **semantic-release**. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this 💪.
24
+ You can find below the list of errors reported by **semantic-release**. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this 💪.
25
25
 
26
26
  Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.
27
27
 
@@ -29,7 +29,7 @@ Once all the errors are resolved, **semantic-release** will release your package
29
29
  branch.name
30
30
  }\` branch. You can also manually restart the failed CI job that runs **semantic-release**.
31
31
 
32
- If you are not sure how to resolve this, here is some links that can help you:
32
+ If you are not sure how to resolve this, here are some links that can help you:
33
33
  - [Usage documentation](${USAGE_DOC_URL})
34
34
  - [Frequently Asked Questions](${FAQ_URL})
35
35
  - [Support channels](${GET_HELP_URL})
@@ -1,5 +1,4 @@
1
1
  const path = require('path');
2
- const {basename} = require('path');
3
2
  const {isPlainObject, castArray, uniqWith, uniq} = require('lodash');
4
3
  const dirGlob = require('dir-glob');
5
4
  const globby = require('globby');
@@ -40,7 +39,7 @@ module.exports = async ({cwd}, assets) =>
40
39
  // - `path` of the matched file
41
40
  // - `name` based on the actual file name (to avoid assets with duplicate `name`)
42
41
  // - other properties of the original asset definition
43
- return globbed.map((file) => ({...asset, path: file, name: basename(file)}));
42
+ return globbed.map((file) => ({...asset, path: file, name: path.basename(file)}));
44
43
  }
45
44
 
46
45
  // If asset is an Object, output an Object definition with:
@@ -5,7 +5,7 @@ module.exports = (repositoryUrl) => {
5
5
  new URL(match ? `ssh://${auth ? `${auth}@` : ''}${host}/${path}` : repositoryUrl).pathname
6
6
  );
7
7
  return {owner, repo};
8
- } catch (_) {
8
+ } catch {
9
9
  return {};
10
10
  }
11
11
  };
package/lib/publish.js CHANGED
@@ -1,4 +1,4 @@
1
- const {basename, extname, resolve} = require('path');
1
+ const path = require('path');
2
2
  const {stat, readFile} = require('fs-extra');
3
3
  const {isPlainObject, template} = require('lodash');
4
4
  const mime = require('mime');
@@ -21,7 +21,15 @@ module.exports = async (pluginConfig, context) => {
21
21
  const {githubToken, githubUrl, githubApiPathPrefix, proxy, assets} = resolveConfig(pluginConfig, context);
22
22
  const {owner, repo} = parseGithubUrl(repositoryUrl);
23
23
  const github = getClient({githubToken, githubUrl, githubApiPathPrefix, proxy});
24
- const release = {owner, repo, tag_name: gitTag, name, body: notes, prerelease: isPrerelease(branch)};
24
+ const release = {
25
+ owner,
26
+ repo,
27
+ tag_name: gitTag,
28
+ target_commitish: branch.name,
29
+ name,
30
+ body: notes,
31
+ prerelease: isPrerelease(branch),
32
+ };
25
33
 
26
34
  debug('release object: %O', release);
27
35
 
@@ -53,8 +61,8 @@ module.exports = async (pluginConfig, context) => {
53
61
  let file;
54
62
 
55
63
  try {
56
- file = await stat(resolve(cwd, filePath));
57
- } catch (_) {
64
+ file = await stat(path.resolve(cwd, filePath));
65
+ } catch {
58
66
  logger.error('The asset %s cannot be read, and will be ignored.', filePath);
59
67
  return;
60
68
  }
@@ -64,13 +72,13 @@ module.exports = async (pluginConfig, context) => {
64
72
  return;
65
73
  }
66
74
 
67
- const fileName = template(asset.name || basename(filePath))(context);
75
+ const fileName = template(asset.name || path.basename(filePath))(context);
68
76
  const upload = {
69
77
  url: uploadUrl,
70
- data: await readFile(resolve(cwd, filePath)),
78
+ data: await readFile(path.resolve(cwd, filePath)),
71
79
  name: fileName,
72
80
  headers: {
73
- 'content-type': mime.getType(extname(fileName)) || 'text/plain',
81
+ 'content-type': mime.getType(path.extname(fileName)) || 'text/plain',
74
82
  'content-length': file.size,
75
83
  },
76
84
  };
@@ -19,7 +19,7 @@ module.exports = (
19
19
  githubToken: env.GH_TOKEN || env.GITHUB_TOKEN,
20
20
  githubUrl: githubUrl || env.GITHUB_API_URL || env.GH_URL || env.GITHUB_URL,
21
21
  githubApiPathPrefix: githubApiPathPrefix || env.GH_PREFIX || env.GITHUB_PREFIX || '',
22
- proxy: proxy || env.HTTP_PROXY,
22
+ proxy: isNil(proxy) ? env.http_proxy || env.HTTP_PROXY || false : proxy,
23
23
  assets: assets ? castArray(assets) : assets,
24
24
  successComment,
25
25
  failTitle: isNil(failTitle) ? 'The automated release is failing 🚨' : failTitle,
package/lib/verify.js CHANGED
@@ -14,8 +14,9 @@ const isArrayOf = (validator) => (array) => isArray(array) && array.every((value
14
14
  const canBeDisabled = (validator) => (value) => value === false || validator(value);
15
15
 
16
16
  const VALIDATORS = {
17
- proxy: (proxy) =>
18
- isNonEmptyString(proxy) || (isPlainObject(proxy) && isNonEmptyString(proxy.host) && isNumber(proxy.port)),
17
+ proxy: canBeDisabled(
18
+ (proxy) => isNonEmptyString(proxy) || (isPlainObject(proxy) && isNonEmptyString(proxy.host) && isNumber(proxy.port))
19
+ ),
19
20
  assets: isArrayOf(
20
21
  (asset) => isStringOrStringArray(asset) || (isPlainObject(asset) && isStringOrStringArray(asset.path))
21
22
  ),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semantic-release/github",
3
3
  "description": "semantic-release plugin to publish a GitHub release and comment on released Pull Requests/Issues",
4
- "version": "7.1.2",
4
+ "version": "7.2.3",
5
5
  "author": "Pierre Vanduynslager (https://twitter.com/@pvdlg_)",
6
6
  "ava": {
7
7
  "files": [
@@ -22,7 +22,7 @@
22
22
  "bottleneck": "^2.18.1",
23
23
  "debug": "^4.0.0",
24
24
  "dir-glob": "^3.0.0",
25
- "fs-extra": "^9.0.0",
25
+ "fs-extra": "^10.0.0",
26
26
  "globby": "^11.0.0",
27
27
  "http-proxy-agent": "^4.0.0",
28
28
  "https-proxy-agent": "^5.0.0",
@@ -34,18 +34,18 @@
34
34
  "url-join": "^4.0.0"
35
35
  },
36
36
  "devDependencies": {
37
- "ava": "3.13.0",
37
+ "ava": "3.15.0",
38
38
  "clear-module": "4.1.1",
39
39
  "codecov": "3.8.1",
40
- "nock": "12.0.3",
40
+ "nock": "13.0.9",
41
41
  "nyc": "15.1.0",
42
42
  "proxy": "1.0.2",
43
43
  "proxyquire": "2.1.3",
44
- "semantic-release": "17.2.2",
44
+ "semantic-release": "17.3.9",
45
45
  "server-destroy": "1.0.1",
46
- "sinon": "9.2.1",
47
- "tempy": "0.5.0",
48
- "xo": "0.30.0"
46
+ "sinon": "9.2.4",
47
+ "tempy": "1.0.0",
48
+ "xo": "0.36.1"
49
49
  },
50
50
  "engines": {
51
51
  "node": ">=10.18"
@@ -99,7 +99,8 @@
99
99
  "lint": "xo",
100
100
  "pretest": "npm run lint",
101
101
  "semantic-release": "semantic-release",
102
- "test": "nyc ava -v"
102
+ "test": "nyc ava -v",
103
+ "test:ci": "nyc ava -v"
103
104
  },
104
105
  "xo": {
105
106
  "prettier": true,
@@ -111,7 +112,8 @@
111
112
  "properties": "never"
112
113
  }
113
114
  ],
114
- "unicorn/string-content": "off"
115
+ "unicorn/string-content": "off",
116
+ "unicorn/no-reduce": "off"
115
117
  }
116
118
  },
117
119
  "renovate": {