@cycjimmy/semantic-release-action 2.5.2 → 2.7.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
@@ -43,14 +43,15 @@ then make sure that you configure this in your `package.json` file:
43
43
  ```
44
44
 
45
45
  ### Inputs
46
- | Input Parameter | Required | Description |
47
- |:----------------:|:--------:|-------------|
48
- | semantic_version | false | Specify specifying version range for semantic-release. [[Details](#semantic_version)] |
49
- | branches | false | The branches on which releases should happen.[[Details](#branches)]<br>Support for **semantic-release above v16**. |
50
- | branch | false | The branch on which releases should happen.[[Details](#branch)]<br>Only support for **semantic-release older than v16**. |
51
- | extra_plugins | false | Extra plugins for pre-install. [[Details](#extra_plugins)] |
52
- | dry_run | false | Whether to run semantic release in `dry-run` mode. [[Details](#dry_run)] |
53
- | extends | false | Use a sharable configuration [[Details](#extends)] |
46
+ | Input Parameter | Required | Description |
47
+ |:-----------------:|:--------:|-------------|
48
+ | semantic_version | false | Specify specifying version range for semantic-release. [[Details](#semantic_version)] |
49
+ | branches | false | The branches on which releases should happen.[[Details](#branches)]<br>Support for **semantic-release above v16**. |
50
+ | branch | false | The branch on which releases should happen.[[Details](#branch)]<br>Only support for **semantic-release older than v16**. |
51
+ | extra_plugins | false | Extra plugins for pre-install. [[Details](#extra_plugins)] |
52
+ | dry_run | false | Whether to run semantic release in `dry-run` mode. [[Details](#dry_run)] |
53
+ | extends | false | Use a sharable configuration [[Details](#extends)] |
54
+ | working_directory | false | Use another working directory for semantic release [[Details](#working_directory)] |
54
55
 
55
56
  #### semantic_version
56
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.
@@ -206,6 +207,23 @@ steps:
206
207
  NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
207
208
  ```
208
209
 
210
+ #### working_directory
211
+ This action run semantic release in the github provided workspace by default. You can override it by setting another working directory.
212
+
213
+ ```yaml
214
+ steps:
215
+ - name: Checkout
216
+ uses: actions/checkout@v2
217
+ - name: Semantic Release
218
+ uses: cycjimmy/semantic-release-action@v2
219
+ with:
220
+ # You can select another working directory like a subdirectory for example.
221
+ working_directory: ./code
222
+ env:
223
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
224
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
225
+ ```
226
+
209
227
  ### Outputs
210
228
  | Output Parameter | Description |
211
229
  |:-------------------------:|---|
@@ -216,6 +234,7 @@ steps:
216
234
  | new_release_patch_version | Patch version of the new release. (e.g. `0`) |
217
235
  | new_release_channel | The distribution channel on which the last release was initially made available (undefined for the default distribution channel). |
218
236
  | new_release_notes | The release notes for the new release. |
237
+ | last_release_version | Version of the previous release, if there was one. (e.g. `1.2.0`) |
219
238
 
220
239
  #### Using Output Variables:
221
240
  ```yaml
package/action.yml CHANGED
@@ -23,6 +23,9 @@ inputs:
23
23
  extends:
24
24
  required: false
25
25
  description: 'One or several sharable configurations, https://semantic-release.gitbook.io/semantic-release/usage/configuration#extends'
26
+ working_directory:
27
+ required: false
28
+ description: 'Specify another working directory for semantic release. Default one is provided by github.'
26
29
  outputs:
27
30
  new_release_published:
28
31
  description: 'Whether a new release was published'
@@ -38,6 +41,8 @@ outputs:
38
41
  description: 'The distribution channel on which the last release was initially made available (undefined for the default distribution channel).'
39
42
  new_release_notes:
40
43
  description: 'The release notes for the new release.'
44
+ last_release_version:
45
+ description: 'Version of the previous release, if there was one.'
41
46
  runs:
42
47
  using: 'node12'
43
48
  main: 'index.js'
package/docs/CHANGELOG.md CHANGED
@@ -1,3 +1,31 @@
1
+ # [2.7.0](https://github.com/cycjimmy/semantic-release-action/compare/v2.6.0...v2.7.0) (2021-12-12)
2
+
3
+
4
+ ### Features
5
+
6
+ * add working dir ([7126083](https://github.com/cycjimmy/semantic-release-action/commit/71260837fb05623446dee88dd211f7530838b234))
7
+
8
+ # [2.6.0](https://github.com/cycjimmy/semantic-release-action/compare/v2.5.4...v2.6.0) (2021-10-15)
9
+
10
+
11
+ ### Features
12
+
13
+ * add output for last release version ([f8175c6](https://github.com/cycjimmy/semantic-release-action/commit/f8175c649133e2d9be14098cc4d41f7ef32316b6))
14
+
15
+ ## [2.5.4](https://github.com/cycjimmy/semantic-release-action/compare/v2.5.3...v2.5.4) (2021-04-30)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * use error loglevel for installing dependencies ([ed6729b](https://github.com/cycjimmy/semantic-release-action/commit/ed6729b716d281c2c4058d3553f3229a80203a79)), closes [#57](https://github.com/cycjimmy/semantic-release-action/issues/57)
21
+
22
+ ## [2.5.3](https://github.com/cycjimmy/semantic-release-action/compare/v2.5.2...v2.5.3) (2020-11-16)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * fix a type error when nextRelease is undefined ([f1ae39a](https://github.com/cycjimmy/semantic-release-action/commit/f1ae39a58a030dccda8bd11b51266b4824871e1f))
28
+
1
29
  ## [2.5.2](https://github.com/cycjimmy/semantic-release-action/compare/v2.5.1...v2.5.2) (2020-11-12)
2
30
 
3
31
 
package/index.js CHANGED
@@ -4,7 +4,7 @@ const path = require('path');
4
4
  const run = async () => {
5
5
  // Install Dependencies
6
6
  {
7
- const {stdout, stderr} = await exec('npm ci --only=prod', {
7
+ const {stdout, stderr} = await exec('npm --loglevel error ci --only=prod', {
8
8
  cwd: path.resolve(__dirname)
9
9
  });
10
10
  console.log(stdout);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cycjimmy/semantic-release-action",
3
- "version": "2.5.2",
3
+ "version": "2.7.0",
4
4
  "description": "GitHub Action for Semantic Release",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "homepage": "https://github.com/cycjimmy/semantic-release-action#readme",
23
23
  "dependencies": {
24
- "@actions/core": "^1.2.6",
25
- "@cycjimmy/awesome-js-funcs": "^2.4.0"
24
+ "@actions/core": "^1.6.0",
25
+ "@cycjimmy/awesome-js-funcs": "^3.1.0"
26
26
  }
27
27
  }
@@ -1,5 +1,5 @@
1
1
  const core = require('@actions/core');
2
- const stringToJson = require('@cycjimmy/awesome-js-funcs/typeConversion/stringToJson').default;
2
+ const stringToJson = require('@cycjimmy/awesome-js-funcs/cjs/typeConversion/stringToJson').default;
3
3
  const inputs = require('./inputs.json');
4
4
 
5
5
  /**
package/src/index.js CHANGED
@@ -16,6 +16,9 @@ const inputs = require('./inputs.json');
16
16
  * @returns {Promise<void>}
17
17
  */
18
18
  const release = async () => {
19
+ if (core.getInput(inputs.working_directory)) {
20
+ process.chdir(core.getInput(inputs.working_directory));
21
+ }
19
22
  await setUpJob();
20
23
  await installSpecifyingVersionSemantic();
21
24
  await preInstall(core.getInput(inputs.extra_plugins));
package/src/inputs.json CHANGED
@@ -4,5 +4,6 @@
4
4
  "branch": "branch",
5
5
  "extra_plugins": "extra_plugins",
6
6
  "dry_run": "dry_run",
7
- "extends": "extends"
7
+ "extends": "extends",
8
+ "working_directory": "working_directory"
8
9
  }
package/src/outputs.json CHANGED
@@ -5,5 +5,6 @@
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"
8
+ "new_release_notes": "new_release_notes",
9
+ "last_release_version": "last_release_version"
9
10
  }
@@ -14,6 +14,11 @@ module.exports = async (result) => {
14
14
 
15
15
  const {lastRelease, commits, nextRelease, releases} = result;
16
16
 
17
+ if (!nextRelease) {
18
+ core.debug('No release published.');
19
+ return Promise.resolve();
20
+ }
21
+
17
22
  core.debug(`Published ${nextRelease.type} release version ${nextRelease.version} containing ${commits.length} commits.`);
18
23
 
19
24
  if (lastRelease.version) {
@@ -35,4 +40,5 @@ module.exports = async (result) => {
35
40
  core.setOutput(outputs.new_release_patch_version, patch);
36
41
  core.setOutput(outputs.new_release_channel, channel);
37
42
  core.setOutput(outputs.new_release_notes, notes);
43
+ core.setOutput(outputs.last_release_version, lastRelease.version)
38
44
  };