@ethima/semantic-release-configuration 4.0.0 → 4.0.1

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
@@ -35,9 +35,12 @@ configuration supporting a range of languages and platforms supported by the
35
35
 
36
36
  ## Usage
37
37
 
38
- - Create the relevant secret token for the platform on which the project
39
- using this configuration is hosted, e.g. `GH_TOKEN`, `GITLAB_TOKEN`. The
40
- supported platforms are [GitHub][semantic-release-github-plugin-auth-url] and
38
+ - Create the [relevant authentication
39
+ token][semantic-release-authentication-url] for the platform on which the
40
+ project using this configuration is hosted. This secret will be used by the
41
+ main `semantic-release` tool for pushing tags as well as the
42
+ platform-specific plugin i.e.
43
+ [GitHub][semantic-release-github-plugin-auth-url] or
41
44
  [GitLab][semantic-release-gitlab-plugin-auth-url].
42
45
 
43
46
  For improved security, _use a unique token for every project this
@@ -228,6 +231,7 @@ release by hand from the tag and changelog that was created by the
228
231
  [juliahub-register-package-url]: https://juliahub.com/ui/Registrator
229
232
  [npm-token-url]: https://docs.npmjs.com/creating-and-viewing-access-tokens#creating-granular-access-tokens-on-the-website
230
233
  [replace-in-file-url]: https://www.npmjs.com/package/replace-in-file
234
+ [semantic-release-authentication-url]: https://semantic-release.gitbook.io/semantic-release/usage/ci-configuration#authentication
231
235
  [semantic-release-changelog-plugin-url]: https://github.com/semantic-release/changelog
232
236
  [semantic-release-commit-analyzer-plugin-url]: https://github.com/semantic-release/commit-analyzer
233
237
  [semantic-release-extends-configuration-url]: https://semantic-release.gitbook.io/semantic-release/usage/configuration#extends
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethima/semantic-release-configuration",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "A shareable semantic release configuration supporting a range of languages and platforms supported by the Ethima organization.",
5
5
  "main": "./src/index.js",
6
6
  "repository": {
@@ -21,9 +21,9 @@
21
21
  "@google/semantic-release-replace-plugin": "1.2.0",
22
22
  "@semantic-release/changelog": "6.0.3",
23
23
  "@semantic-release/git": "10.0.1",
24
- "@semantic-release/github": "8.0.7",
25
- "@semantic-release/gitlab": "12.0.1",
26
- "conventional-changelog-conventionalcommits": "5.0.0",
27
- "cosmiconfig": "8.1.3"
24
+ "@semantic-release/github": "9.0.3",
25
+ "@semantic-release/gitlab": "12.0.3",
26
+ "conventional-changelog-conventionalcommits": "6.0.0",
27
+ "cosmiconfig": "8.2.0"
28
28
  }
29
29
  }
package/src/index.js CHANGED
@@ -9,25 +9,19 @@ const GIT_ASSETS = [
9
9
  ...CONFIGURATION.files_with_versioned_templates,
10
10
  ];
11
11
 
12
- // Used to detect whether configuration for either the
13
- // `semantic-release/github`, `semantic-release/gitlab` or both platform
14
- // release plugins has been provided through the environment
15
- const GITHUB_TOKEN_NAMES = ["GH_TOKEN", "GITHUB_TOKEN"];
16
- const GITLAB_TOKEN_NAMES = ["GL_TOKEN", "GITLAB_TOKEN"];
17
-
18
12
  /*
19
13
  * Determines whether the provided plugin should be added to the semantic
20
14
  * release configuration based on the presence of select environment variables.
21
15
  *
22
- * @param {Array} token_names An array of strings specifying the names of the
23
- * environment variables to detect.
16
+ * @param {string} environment_variable The environment variable to verify the
17
+ * existence of (and equality to `"true"`) to include the specified `plugin`.
24
18
  * @param {string} plugin The name of the NPM package providing the plugin.
25
19
  *
26
- * @return {Array} References the plugin if any of the `token_names` are
27
- * detected and is empty otherwise.
20
+ * @return {Array} References the plugin if the `environment_variable` was set
21
+ * to `"true"` and is empty otherwise.
28
22
  */
29
- function platformSpecificReleasePlugin(token_names, plugin) {
30
- return token_names.some((token_name) => env[token_name]) ? [plugin] : [];
23
+ function platformSpecificReleasePlugin(environment_variable, plugin) {
24
+ return env[environment_variable] === "true" ? [plugin] : [];
31
25
  }
32
26
 
33
27
  // Ensure the NPM plugin gets added to the semantic release pipeline if a
@@ -101,13 +95,10 @@ const SEMANTIC_RELEASE_CONFIGURATION = {
101
95
  },
102
96
  ],
103
97
  ...platformSpecificReleasePlugin(
104
- GITHUB_TOKEN_NAMES,
98
+ "GITHUB_ACTIONS",
105
99
  "@semantic-release/github"
106
100
  ),
107
- ...platformSpecificReleasePlugin(
108
- GITLAB_TOKEN_NAMES,
109
- "@semantic-release/gitlab"
110
- ),
101
+ ...platformSpecificReleasePlugin("GITLAB_CI", "@semantic-release/gitlab"),
111
102
  ],
112
103
  };
113
104