@cycjimmy/semantic-release-action 3.2.0 → 3.4.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.
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![semantic-release][semantic-image]][semantic-url]
6
6
  [![npm license][license-image]][license-url]
7
7
 
8
- GitHub Action for [Semantic Release][semantic-url].
8
+ GitHub Action for [Semantic Release][semantic-url].
9
9
 
10
10
  ## Usage
11
11
  ### Step1: Set any [Semantic Release Configuration](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#configuration) in your repository.
@@ -45,16 +45,18 @@ then make sure that you configure this in your `package.json` file:
45
45
  ### Inputs
46
46
  | Input Parameter | Required | Description |
47
47
  |:-----------------:|:--------:|--------------------------------------------------------------------------------------------------------------------------|
48
- | semantic_version | false | Specify specifying version range for semantic-release. [[Details](#semantic_version)] |
48
+ | semantic_version | false | Specify version range for semantic-release. [[Details](#semantic_version)] |
49
49
  | branches | false | The branches on which releases should happen.[[Details](#branches)]<br>Support for **semantic-release above v16**. |
50
50
  | branch | false | The branch on which releases should happen.[[Details](#branch)]<br>Only support for **semantic-release older than v16**. |
51
51
  | extra_plugins | false | Extra plugins for pre-install. [[Details](#extra_plugins)] |
52
52
  | dry_run | false | Whether to run semantic release in `dry-run` mode. [[Details](#dry_run)] |
53
+ | ci | false | Whether to run semantic release with CI support. [[Details](#ci)]<br>Support for **semantic-release above v16**. |
53
54
  | extends | false | Use a sharable configuration [[Details](#extends)] |
54
55
  | working_directory | false | Use another working directory for semantic release [[Details](#working_directory)] |
56
+ | tag_format | false | Specify format of tag (useful for monorepos) |
55
57
 
56
58
  #### semantic_version
57
- > {Optional Input Parameter} Specify specifying version range for semantic-release.<br>If no version range is specified, latest version will be used by default.
59
+ > {Optional Input Parameter} Specify version range for semantic-release.
58
60
 
59
61
  ```yaml
60
62
  steps:
@@ -63,14 +65,17 @@ steps:
63
65
  - name: Semantic Release
64
66
  uses: cycjimmy/semantic-release-action@v3
65
67
  with:
66
- semantic_version: 15.13.28 # It is recommended to specify specifying version range
67
- # for semantic-release.
68
+ semantic_version: 19.0.5 # It is recommended to specify a version range
69
+ # for semantic-release when using
70
+ # semantic-release-action lower than @v3
68
71
  env:
69
72
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70
73
  NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
71
74
  ```
72
75
 
73
- *It is recommended to manually specify a version of semantic-release to prevent errors caused during the official semantic-release upgrade.*
76
+ If no version range is specified with `cycjimmy/semantic-release-action@v3` then [semantic-release](https://github.com/semantic-release/semantic-release/) version [19.0.5](https://github.com/semantic-release/semantic-release/releases/tag/v19.0.5) is used. Earlier versions of `cycjimmy/semantic-release-action` default to using the latest version of [semantic-release](https://github.com/semantic-release/semantic-release/), so in this case it is recommended to specify version 19 or lower to avoid compatibility issues.
77
+
78
+ *Note: [Version 20.0.0](https://github.com/semantic-release/semantic-release/releases/tag/v20.0.0) of [semantic-release](https://github.com/semantic-release/semantic-release/) and later is currently incompatible with `cycjimmy/semantic-release-action`, since it requires Node.js 18. GitHub does not provide this environment yet for [JavaScript actions](https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-javascript-actions).*
74
79
 
75
80
  #### branches
76
81
  > {Optional Input Parameter} The branches on which releases should happen.<br>`branches` supports for **semantic-release above v16**.
@@ -84,18 +89,18 @@ steps:
84
89
  with:
85
90
  semantic_version: 16
86
91
  # you can set branches for semantic-release above v16.
87
- branches: |
92
+ branches: |
88
93
  [
89
94
  '+([0-9])?(.{+([0-9]),x}).x',
90
- 'master',
91
- 'next',
92
- 'next-major',
95
+ 'master',
96
+ 'next',
97
+ 'next-major',
93
98
  {
94
- name: 'beta',
99
+ name: 'beta',
95
100
  prerelease: true
96
- },
101
+ },
97
102
  {
98
- name: 'alpha',
103
+ name: 'alpha',
99
104
  prerelease: true
100
105
  }
101
106
  ]
@@ -104,14 +109,14 @@ steps:
104
109
  NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
105
110
  ```
106
111
 
107
- `branches` will override the `branches` attribute in your configuration file. If the attribute is not configured on both sides, the default is:
112
+ `branches` will override the `branches` attribute in your configuration file. If the attribute is not configured on both sides, the default is:
108
113
  ```
109
114
  [
110
115
  '+([0-9])?(.{+([0-9]),x}).x',
111
- 'master',
112
- 'next',
113
- 'next-major',
114
- {name: 'beta', prerelease: true},
116
+ 'master',
117
+ 'next',
118
+ 'next-major',
119
+ {name: 'beta', prerelease: true},
115
120
  {name: 'alpha', prerelease: true}
116
121
  ]
117
122
  ```
@@ -139,9 +144,9 @@ steps:
139
144
  It will override the `branch` attribute in your configuration file. If the attribute is not configured on both sides, the default is `master`.
140
145
 
141
146
  #### extra_plugins
142
- > {Optional Input Parameter} Extra plugins for pre-install.
147
+ > {Optional Input Parameter} Extra plugins for pre-install.
143
148
 
144
- The action can be used with `extra_plugins` option to specify plugins which are not in the [default list of plugins of semantic release](https://semantic-release.gitbook.io/semantic-release/usage/plugins#default-plugins). When using this option, please make sure that these plugins are also mentioned in your [semantic release config's plugins](https://semantic-release.gitbook.io/semantic-release/usage/configuration#plugins) array.
149
+ The action can be used with `extra_plugins` option to specify plugins which are not in the [default list of plugins of semantic release](https://semantic-release.gitbook.io/semantic-release/usage/plugins#default-plugins). When using this option, please make sure that these plugins are also mentioned in your [semantic release config's plugins](https://semantic-release.gitbook.io/semantic-release/usage/configuration#plugins) array.
145
150
 
146
151
  For example, if you want to use `@semantic-release/git` and `@semantic-release/changelog` extra plugins, these must be added to `extra_plugins` in your actions file and `plugins` in your [release config file](https://semantic-release.gitbook.io/semantic-release/usage/configuration#configuration-file) as shown bellow:
147
152
 
@@ -155,7 +160,7 @@ steps:
155
160
  with:
156
161
  # You can specify specifying version range for the extra plugins if you prefer.
157
162
  extra_plugins: |
158
- @semantic-release/changelog@3.0.0
163
+ @semantic-release/changelog@6.0.0
159
164
  @semantic-release/git
160
165
  env:
161
166
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -189,6 +194,24 @@ steps:
189
194
  NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
190
195
  ```
191
196
 
197
+ #### ci
198
+ > {Optional Input Parameter} Whether to run semantic release with CI support (default true).<br>`ci` supports for **semantic-release above v16**.
199
+
200
+ ```yaml
201
+ steps:
202
+ - name: Checkout
203
+ uses: actions/checkout@v3
204
+ - name: Semantic Release
205
+ uses: cycjimmy/semantic-release-action@v3
206
+ with:
207
+ ci: false
208
+ env:
209
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
210
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
211
+ ```
212
+
213
+ `ci` can be used, e.g in combination with `dry_run` when generating the next release version in pull requests, where `semantic_release` would normally block the execution.
214
+
192
215
  #### extends
193
216
  The action can be used with `extends` option to extend an existing [sharable configuration](https://semantic-release.gitbook.io/semantic-release/usage/shareable-configurations) of semantic-release. Can be used in combination with `extra_plugins`.
194
217
 
@@ -226,6 +249,22 @@ steps:
226
249
  NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
227
250
  ```
228
251
 
252
+ #### tag_format
253
+ The default tag format on semantic-release is `v{version}`. You can override that behavior using this option (helpful when you are using monorepos)
254
+
255
+ ```yaml
256
+ steps:
257
+ - name: Checkout
258
+ uses: actions/checkout@v3
259
+ - name: Semantic Release
260
+ uses: cycjimmy/semantic-release-action@v3
261
+ with:
262
+ tag_format: custom-v{version}
263
+ env:
264
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
265
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
266
+ ```
267
+
229
268
  ### Outputs
230
269
  | Output Parameter | Description |
231
270
  |:-------------------------:|-----------------------------------------------------------------------------------------------------------------------------------|
@@ -253,7 +292,7 @@ steps:
253
292
  env:
254
293
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
255
294
  NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
256
-
295
+
257
296
  - name: Do something when a new release published
258
297
  if: steps.semantic.outputs.new_release_published == 'true'
259
298
  run: |
package/action.yml CHANGED
@@ -20,12 +20,18 @@ inputs:
20
20
  dry_run:
21
21
  required: false
22
22
  description: 'Whether to run semantic release in `dry-run` mode. It will override the dryRun attribute in your configuration file'
23
+ ci:
24
+ required: false
25
+ description: 'Whether to run semantic release with CI support (default: true). It will override the ci attribute in your configuration file'
23
26
  extends:
24
27
  required: false
25
28
  description: 'One or several sharable configurations, https://semantic-release.gitbook.io/semantic-release/usage/configuration#extends'
26
29
  working_directory:
27
30
  required: false
28
31
  description: 'Specify another working directory for semantic release. Default one is provided by github.'
32
+ tag_format:
33
+ required: false
34
+ description: 'The default tag format on semantic-release is v{version}. You can override that behavior using this option.'
29
35
  outputs:
30
36
  new_release_published:
31
37
  description: 'Whether a new release was published'
package/docs/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [3.4.0](https://github.com/cycjimmy/semantic-release-action/compare/v3.3.0...v3.4.0) (2023-03-15)
2
+
3
+
4
+ ### Features
5
+
6
+ * add `ci` input parameter ([b356b18](https://github.com/cycjimmy/semantic-release-action/commit/b356b18b5f474bb4b9fe4bb5801b364ce24aa8f6))
7
+
8
+ # [3.3.0](https://github.com/cycjimmy/semantic-release-action/compare/v3.2.0...v3.3.0) (2023-03-07)
9
+
10
+
11
+ ### Features
12
+
13
+ * support for option tagFormat ([ed38eb0](https://github.com/cycjimmy/semantic-release-action/commit/ed38eb0e9938eefc792510a75ec48d80fead9b21))
14
+
1
15
  # [3.2.0](https://github.com/cycjimmy/semantic-release-action/compare/v3.1.2...v3.2.0) (2022-11-04)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cycjimmy/semantic-release-action",
3
- "version": "3.2.0",
3
+ "version": "3.4.0",
4
4
  "description": "GitHub Action for Semantic Release",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -23,7 +23,7 @@
23
23
  "dependencies": {
24
24
  "@actions/core": "^1.10.0",
25
25
  "@cycjimmy/awesome-js-funcs": "^4.0.4",
26
- "@semantic-release/changelog": "^6.0.1",
26
+ "@semantic-release/changelog": "^6.0.2",
27
27
  "@semantic-release/git": "^10.0.1",
28
28
  "semantic-release": "^19.0.5"
29
29
  }
@@ -60,6 +60,25 @@ exports.handleDryRunOption = () => {
60
60
  }
61
61
  };
62
62
 
63
+ /**
64
+ * Handle Ci Option
65
+ * @returns {{}|{ci: boolean}}
66
+ */
67
+ exports.handleCiOption = () => {
68
+ const ci = core.getInput(inputs.ci);
69
+
70
+ switch (ci) {
71
+ case 'true':
72
+ return { ci: true, noCi: false };
73
+
74
+ case 'false':
75
+ return { ci: false, noCi: true };
76
+
77
+ default:
78
+ return {};
79
+ }
80
+ };
81
+
63
82
  /**
64
83
  * Handle Extends Option
65
84
  * @returns {{}|{extends: Array}|{extends: String}}
@@ -77,3 +96,19 @@ exports.handleExtends = () => {
77
96
  return {};
78
97
  }
79
98
  };
99
+
100
+ /**
101
+ * Handle TagFormat Option
102
+ * @returns {{}|{tagFormat: String}}
103
+ */
104
+ exports.handleTagFormat = () => {
105
+ const tagFormat = core.getInput(inputs.tag_format);
106
+
107
+ if (tagFormat) {
108
+ return {
109
+ tagFormat
110
+ };
111
+ } else {
112
+ return {};
113
+ }
114
+ };
package/src/index.js CHANGED
@@ -2,7 +2,9 @@ const core = require('@actions/core');
2
2
  const {
3
3
  handleBranchesOption,
4
4
  handleDryRunOption,
5
+ handleCiOption,
5
6
  handleExtends,
7
+ handleTagFormat,
6
8
  } = require('./handleOptions');
7
9
  const setUpJob = require('./setUpJob.task');
8
10
  const installSpecifyingVersionSemantic = require('./installSpecifyingVersionSemantic.task');
@@ -28,7 +30,9 @@ const release = async () => {
28
30
  const result = await semanticRelease({
29
31
  ...handleBranchesOption(),
30
32
  ...handleDryRunOption(),
33
+ ...handleCiOption(),
31
34
  ...handleExtends(),
35
+ ...handleTagFormat()
32
36
  });
33
37
 
34
38
  await cleanupNpmrc();
package/src/inputs.json CHANGED
@@ -4,6 +4,8 @@
4
4
  "branch": "branch",
5
5
  "extra_plugins": "extra_plugins",
6
6
  "dry_run": "dry_run",
7
+ "ci": "ci",
7
8
  "extends": "extends",
8
- "working_directory": "working_directory"
9
+ "working_directory": "working_directory",
10
+ "tag_format": "tag_format"
9
11
  }