@ethima/semantic-release-configuration 2.1.1 → 3.1.0

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.
Files changed (3) hide show
  1. package/README.md +21 -15
  2. package/package.json +3 -1
  3. package/src/index.js +4 -2
package/README.md CHANGED
@@ -7,7 +7,10 @@ configuration supporting a range of languages and platforms supported by the
7
7
  ## Features
8
8
 
9
9
  - Analyzes commits using
10
- [`@semantic-release/commit-analyzer`][semantic-release-commit-analyzer-plugin-url].
10
+ [`@semantic-release/commit-analyzer`][semantic-release-commit-analyzer-plugin-url]
11
+ and the [`conventional-changelog-conventionalcommits`
12
+ preset][conventionalcommits-preset-url] implementing the [Conventional
13
+ Commits specification][conventionalcommits-url].
11
14
  - Generates release notes using
12
15
  [`@semantic-release/release-notes-generator`][semantic-release-notes-generator-plugin-url].
13
16
  - Updates templated content in a project's root-level `README.md` file
@@ -20,8 +23,10 @@ configuration supporting a range of languages and platforms supported by the
20
23
  - (Conditionally) maintains NPM package files, i.e. `package.json` and
21
24
  publishes using [`@semantic-release/npm`][semantic-release-npm-plugin-url]
22
25
  and [`@semantic-release/git`][semantic-release-git-plugin-url].
23
- - Publishes releases to GitLab using
24
- [`@semantic-release/gitlab`][semantic-release-gitlab-plugin-url].
26
+ - Publishes releases to GitHub using
27
+ [`@semantic-release/github`][semantic-release-github-plugin-url] when
28
+ running from GitHub Actions and to GitLab using
29
+ [`@semantic-release/gitlab`][semantic-release-gitlab-plugin-url] otherwise.
25
30
 
26
31
  ## Usage
27
32
 
@@ -36,6 +41,12 @@ configuration supporting a range of languages and platforms supported by the
36
41
  [`extends`][semantic-release-extends-configuration-url] configuration for the
37
42
  project to be semantically released.
38
43
 
44
+ - When using this shareable semantic release configuration from GitHub Actions,
45
+ ensure a `CI_DEFAULT_BRANCH` environment variable is set to the name of the
46
+ branch from which releases should be created. Unfortunately, GitHub does not
47
+ make this information readily available through, for instance, a similarly
48
+ named environment variable.
49
+
39
50
  ### Configuration
40
51
 
41
52
  The semantic release configuration has several configuration options itself.
@@ -86,14 +97,9 @@ structure:
86
97
  - A `<!-- START_VERSIONED_TEMPLATE` token,
87
98
  - the template itself with one or more
88
99
  `__NEXT_SEMANTIC_RELEASE_VERSION__` tokens,
89
- - a comment closing tag `-->
90
-
91
- ` token,
92
- - the template itself with one or more
93
- `2.1.1` tokens,
94
- - a comment closing tag `
95
-
96
- <!-- END_VERSIONED_TEMPLATE -->`.
100
+ - a comment closing tag `-->`,
101
+ - (optionally) content that was previously templated,
102
+ - a comment closing the templated content `<!-- END_VERSIONED_TEMPLATE -->`.
97
103
 
98
104
  More concretely a section in a `README` that looks like
99
105
 
@@ -103,9 +109,6 @@ More concretely a section in a `README` that looks like
103
109
  The next semantically released version will be v__NEXT_SEMANTIC_RELEASE_VERSION__!
104
110
 
105
111
  -->
106
-
107
- The next semantically released version will be v2.1.1!
108
-
109
112
  <!-- END_VERSIONED_TEMPLATE -->
110
113
  ```
111
114
 
@@ -119,7 +122,7 @@ The next semantically released version will be v__NEXT_SEMANTIC_RELEASE_VERSION_
119
122
 
120
123
  -->
121
124
 
122
- The next semantically released version will be v2.1.1!
125
+ The next semantically released version will be v1.2.3!
123
126
 
124
127
  <!-- END_VERSIONED_TEMPLATE -->
125
128
  ```
@@ -185,6 +188,8 @@ When this happens, it is typically also necessary to create the initial GitHub
185
188
  release by hand from the tag and changelog that was created by the
186
189
  [`semantic-release`][semantic-release-url] tooling.
187
190
 
191
+ [conventionalcommits-url]: https://www.conventionalcommits.org
192
+ [conventionalcommits-preset-url]: https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-conventionalcommits
188
193
  [cosmiconfig-url]: https://www.npmjs.com/package/cosmiconfig
189
194
  [gitlab-pat-url]: https://gitlab.com/-/profile/personal_access_tokens
190
195
  [npm-token-url]: https://docs.npmjs.com/creating-and-viewing-access-tokens#creating-granular-access-tokens-on-the-website
@@ -193,6 +198,7 @@ release by hand from the tag and changelog that was created by the
193
198
  [semantic-release-commit-analyzer-plugin-url]: https://github.com/semantic-release/commit-analyzer
194
199
  [semantic-release-extends-configuration-url]: https://semantic-release.gitbook.io/semantic-release/usage/configuration#extends
195
200
  [semantic-release-git-plugin-url]: https://github.com/semantic-release/git
201
+ [semantic-release-github-plugin-url]: https://github.com/semantic-release/github
196
202
  [semantic-release-gitlab-plugin-url]: https://github.com/semantic-release/gitlab
197
203
  [semantic-release-notes-generator-plugin-url]: https://github.com/semantic-release/release-notes-generator
198
204
  [semantic-release-npm-plugin-configuration-url]: https://github.com/semantic-release/npm#npm-registry-authentication
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethima/semantic-release-configuration",
3
- "version": "2.1.1",
3
+ "version": "3.1.0",
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,7 +21,9 @@
21
21
  "@google/semantic-release-replace-plugin": "1.2.0",
22
22
  "@semantic-release/changelog": "6.0.2",
23
23
  "@semantic-release/git": "10.0.1",
24
+ "@semantic-release/github": "8.0.7",
24
25
  "@semantic-release/gitlab": "9.5.1",
26
+ "conventional-changelog-conventionalcommits": "5.0.0",
25
27
  "cosmiconfig": "8.0.0"
26
28
  }
27
29
  }
package/src/index.js CHANGED
@@ -9,6 +9,8 @@ const GIT_ASSETS = [
9
9
  ...CONFIGURATION.files_with_versioned_templates,
10
10
  ];
11
11
 
12
+ const IS_GITHUB = env.GITHUB_ACTIONS === "true";
13
+
12
14
  // Ensure the NPM plugin gets added to the semantic release pipeline if a
13
15
  // `package.json` file is detected
14
16
  const NPM_PLUGIN = [];
@@ -21,7 +23,7 @@ try {
21
23
  const SEMANTIC_RELEASE_CONFIGURATION = {
22
24
  branches: [env.CI_DEFAULT_BRANCH],
23
25
  plugins: [
24
- "@semantic-release/commit-analyzer",
26
+ ["@semantic-release/commit-analyzer", { preset: "conventionalcommits" }],
25
27
  "@semantic-release/release-notes-generator",
26
28
  [
27
29
  "@semantic-release/changelog",
@@ -42,7 +44,7 @@ const SEMANTIC_RELEASE_CONFIGURATION = {
42
44
  "chore(release): ${nextRelease.version}\n\n${nextRelease.notes}",
43
45
  },
44
46
  ],
45
- "@semantic-release/gitlab",
47
+ IS_GITHUB ? "@semantic-release/github" : "@semantic-release/gitlab",
46
48
  ],
47
49
  };
48
50