@cycjimmy/semantic-release-action 3.1.2 → 3.3.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,12 +5,12 @@
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
- ### Step1: Set any [Semantic Release Configuration](https://github.com/semantic-release/semantic-release/blob/main/docs/usage/configuration.md#configuration) in your repository.
11
+ ### Step1: Set any [Semantic Release Configuration](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#configuration) in your repository.
12
12
 
13
- ### Step2: [Add Secrets](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets) in your repository for the [Semantic Release Authentication](https://github.com/semantic-release/semantic-release/blob/main/docs/usage/ci-configuration.md#authentication) Environment Variables.
13
+ ### Step2: [Add Secrets](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets) in your repository for the [Semantic Release Authentication](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/ci-configuration.md#authentication) Environment Variables.
14
14
 
15
15
  ### Step3: Add a [Workflow File](https://help.github.com/en/articles/workflow-syntax-for-github-actions) to your repository to create custom automated processes.
16
16
 
@@ -45,16 +45,17 @@ 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
53
  | extends | false | Use a sharable configuration [[Details](#extends)] |
54
54
  | working_directory | false | Use another working directory for semantic release [[Details](#working_directory)] |
55
+ | tag_format | false | Specify format of tag (useful for monorepos) |
55
56
 
56
57
  #### 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.
58
+ > {Optional Input Parameter} Specify version range for semantic-release.
58
59
 
59
60
  ```yaml
60
61
  steps:
@@ -63,14 +64,17 @@ steps:
63
64
  - name: Semantic Release
64
65
  uses: cycjimmy/semantic-release-action@v3
65
66
  with:
66
- semantic_version: 15.13.28 # It is recommended to specify specifying version range
67
- # for semantic-release.
67
+ semantic_version: 19.0.5 # It is recommended to specify a version range
68
+ # for semantic-release when using
69
+ # semantic-release-action lower than @v3
68
70
  env:
69
71
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70
72
  NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
71
73
  ```
72
74
 
73
- *It is recommended to manually specify a version of semantic-release to prevent errors caused during the official semantic-release upgrade.*
75
+ 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.
76
+
77
+ *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
78
 
75
79
  #### branches
76
80
  > {Optional Input Parameter} The branches on which releases should happen.<br>`branches` supports for **semantic-release above v16**.
@@ -84,18 +88,18 @@ steps:
84
88
  with:
85
89
  semantic_version: 16
86
90
  # you can set branches for semantic-release above v16.
87
- branches: |
91
+ branches: |
88
92
  [
89
93
  '+([0-9])?(.{+([0-9]),x}).x',
90
- 'master',
91
- 'next',
92
- 'next-major',
94
+ 'master',
95
+ 'next',
96
+ 'next-major',
93
97
  {
94
- name: 'beta',
98
+ name: 'beta',
95
99
  prerelease: true
96
- },
100
+ },
97
101
  {
98
- name: 'alpha',
102
+ name: 'alpha',
99
103
  prerelease: true
100
104
  }
101
105
  ]
@@ -104,14 +108,14 @@ steps:
104
108
  NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
105
109
  ```
106
110
 
107
- `branches` will override the `branches` attribute in your configuration file. If the attribute is not configured on both sides, the default is:
111
+ `branches` will override the `branches` attribute in your configuration file. If the attribute is not configured on both sides, the default is:
108
112
  ```
109
113
  [
110
114
  '+([0-9])?(.{+([0-9]),x}).x',
111
- 'master',
112
- 'next',
113
- 'next-major',
114
- {name: 'beta', prerelease: true},
115
+ 'master',
116
+ 'next',
117
+ 'next-major',
118
+ {name: 'beta', prerelease: true},
115
119
  {name: 'alpha', prerelease: true}
116
120
  ]
117
121
  ```
@@ -139,9 +143,9 @@ steps:
139
143
  It will override the `branch` attribute in your configuration file. If the attribute is not configured on both sides, the default is `master`.
140
144
 
141
145
  #### extra_plugins
142
- > {Optional Input Parameter} Extra plugins for pre-install.
146
+ > {Optional Input Parameter} Extra plugins for pre-install.
143
147
 
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.
148
+ 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
149
 
146
150
  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
151
 
@@ -155,7 +159,7 @@ steps:
155
159
  with:
156
160
  # You can specify specifying version range for the extra plugins if you prefer.
157
161
  extra_plugins: |
158
- @semantic-release/changelog@3.0.0
162
+ @semantic-release/changelog@6.0.0
159
163
  @semantic-release/git
160
164
  env:
161
165
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -226,6 +230,22 @@ steps:
226
230
  NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
227
231
  ```
228
232
 
233
+ #### tag_format
234
+ The default tag format on semantic-release is `v{version}`. You can override that behavior using this option (helpful when you are using monorepos)
235
+
236
+ ```yaml
237
+ steps:
238
+ - name: Checkout
239
+ uses: actions/checkout@v3
240
+ - name: Semantic Release
241
+ uses: cycjimmy/semantic-release-action@v3
242
+ with:
243
+ tag_format: custom-v{version}
244
+ env:
245
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
246
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
247
+ ```
248
+
229
249
  ### Outputs
230
250
  | Output Parameter | Description |
231
251
  |:-------------------------:|-----------------------------------------------------------------------------------------------------------------------------------|
@@ -236,7 +256,11 @@ steps:
236
256
  | new_release_patch_version | Patch version of the new release. (e.g. `"0"`) |
237
257
  | new_release_channel | The distribution channel on which the last release was initially made available (undefined for the default distribution channel). |
238
258
  | new_release_notes | The release notes for the new release. |
239
- | last_release_version | Version of the previous release, if there was one. (e.g. `"1.2.0"`) |
259
+ | new_release_git_head | The sha of the last commit being part of the new release |
260
+ | new_release_git_tag | The Git tag associated with the new release. |
261
+ | last_release_version | Version of the previous release, if there was one. (e.g. `1.2.0`) |
262
+ | last_release_git_head | The sha of the last commit being part of the last release, if there was one. |
263
+ | last_release_git_tag | The Git tag associated with the last release, if there was one. | |
240
264
 
241
265
  #### Using Output Variables:
242
266
  ```yaml
@@ -249,7 +273,7 @@ steps:
249
273
  env:
250
274
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
251
275
  NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
252
-
276
+
253
277
  - name: Do something when a new release published
254
278
  if: steps.semantic.outputs.new_release_published == 'true'
255
279
  run: |
package/action.yml CHANGED
@@ -26,6 +26,9 @@ inputs:
26
26
  working_directory:
27
27
  required: false
28
28
  description: 'Specify another working directory for semantic release. Default one is provided by github.'
29
+ tag_format:
30
+ required: false
31
+ description: 'The default tag format on semantic-release is v{version}. You can override that behavior using this option.'
29
32
  outputs:
30
33
  new_release_published:
31
34
  description: 'Whether a new release was published'
@@ -41,8 +44,16 @@ outputs:
41
44
  description: 'The distribution channel on which the last release was initially made available (undefined for the default distribution channel).'
42
45
  new_release_notes:
43
46
  description: 'The release notes for the new release.'
47
+ new_release_git_head:
48
+ description: 'The sha of the last commit being part of the new release.'
49
+ new_release_git_tag:
50
+ description: 'The Git tag associated with the new release.'
44
51
  last_release_version:
45
52
  description: 'Version of the previous release, if there was one.'
53
+ last_release_git_head:
54
+ description: 'The sha of the last commit being part of the last release, if there was one.'
55
+ last_release_git_tag:
56
+ description: 'The Git tag associated with the last release, if there was one.'
46
57
  runs:
47
58
  using: 'node16'
48
59
  main: 'index.js'
package/docs/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [3.3.0](https://github.com/cycjimmy/semantic-release-action/compare/v3.2.0...v3.3.0) (2023-03-07)
2
+
3
+
4
+ ### Features
5
+
6
+ * support for option tagFormat ([ed38eb0](https://github.com/cycjimmy/semantic-release-action/commit/ed38eb0e9938eefc792510a75ec48d80fead9b21))
7
+
8
+ # [3.2.0](https://github.com/cycjimmy/semantic-release-action/compare/v3.1.2...v3.2.0) (2022-11-04)
9
+
10
+
11
+ ### Features
12
+
13
+ * added gitHead and gitTag outputs ([385af4f](https://github.com/cycjimmy/semantic-release-action/commit/385af4fa1ceaf60ec10e35b950e9c1cbb9375a8c))
14
+
1
15
  ## [3.1.2](https://github.com/cycjimmy/semantic-release-action/compare/v3.1.1...v3.1.2) (2022-10-19)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cycjimmy/semantic-release-action",
3
- "version": "3.1.2",
3
+ "version": "3.3.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
  }
@@ -77,3 +77,19 @@ exports.handleExtends = () => {
77
77
  return {};
78
78
  }
79
79
  };
80
+
81
+ /**
82
+ * Handle TagFormat Option
83
+ * @returns {{}|{tagFormat: String}}
84
+ */
85
+ exports.handleTagFormat = () => {
86
+ const tagFormat = core.getInput(inputs.tag_format);
87
+
88
+ if (tagFormat) {
89
+ return {
90
+ tagFormat
91
+ };
92
+ } else {
93
+ return {};
94
+ }
95
+ };
package/src/index.js CHANGED
@@ -3,6 +3,7 @@ const {
3
3
  handleBranchesOption,
4
4
  handleDryRunOption,
5
5
  handleExtends,
6
+ handleTagFormat,
6
7
  } = require('./handleOptions');
7
8
  const setUpJob = require('./setUpJob.task');
8
9
  const installSpecifyingVersionSemantic = require('./installSpecifyingVersionSemantic.task');
@@ -29,6 +30,7 @@ const release = async () => {
29
30
  ...handleBranchesOption(),
30
31
  ...handleDryRunOption(),
31
32
  ...handleExtends(),
33
+ ...handleTagFormat()
32
34
  });
33
35
 
34
36
  await cleanupNpmrc();
package/src/inputs.json CHANGED
@@ -5,5 +5,6 @@
5
5
  "extra_plugins": "extra_plugins",
6
6
  "dry_run": "dry_run",
7
7
  "extends": "extends",
8
- "working_directory": "working_directory"
8
+ "working_directory": "working_directory",
9
+ "tag_format": "tag_format"
9
10
  }
package/src/outputs.json CHANGED
@@ -5,6 +5,10 @@
5
5
  "new_release_minor_version": "new_release_minor_version",
6
6
  "new_release_patch_version": "new_release_patch_version",
7
7
  "new_release_channel": "new_release_channel",
8
- "new_release_notes": "new_release_notes",
9
- "last_release_version": "last_release_version"
8
+ "new_release_notes": "new_release_notes",
9
+ "new_release_git_head": "new_release_git_head",
10
+ "new_release_git_tag": "new_release_git_tag",
11
+ "last_release_version": "last_release_version",
12
+ "last_release_git_head": "last_release_git_head",
13
+ "last_release_git_tag": "last_release_git_tag"
10
14
  }
@@ -30,7 +30,7 @@ module.exports = async (result) => {
30
30
  core.debug(`The release was published with plugin "${release.pluginName}".`);
31
31
  }
32
32
 
33
- const {version, channel, notes} = nextRelease;
33
+ const {version, channel, notes, gitHead, gitTag} = nextRelease;
34
34
  const [major, minor, patch] = version.split(/\.|-|\s/g, 3);
35
35
 
36
36
  // set outputs
@@ -40,5 +40,10 @@ module.exports = async (result) => {
40
40
  core.setOutput(outputs.new_release_minor_version, minor);
41
41
  core.setOutput(outputs.new_release_patch_version, patch);
42
42
  core.setOutput(outputs.new_release_channel, channel);
43
- core.setOutput(outputs.new_release_notes, notes);
43
+ core.setOutput(outputs.new_release_notes, notes);
44
+ core.setOutput(outputs.new_release_git_head, gitHead);
45
+ core.setOutput(outputs.new_release_git_tag, gitTag);
46
+ core.setOutput(outputs.last_release_version, lastRelease.version);
47
+ core.setOutput(outputs.last_release_git_head, lastRelease.gitHead);
48
+ core.setOutput(outputs.last_release_git_tag, lastRelease.gitTag);
44
49
  };