5
0
Fork 0
mirror of https://github.com/cycjimmy/semantic-release-action.git synced 2025-11-07 10:46:56 +00:00

Merge pull request #88 from Thomgrus/feat/add-working-dir

feat: add working dir
This commit is contained in:
Geoffrey.C 2021-12-12 20:57:48 +08:00 committed by GitHub
commit a974dcb175
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 9 deletions

View file

@ -43,14 +43,15 @@ then make sure that you configure this in your `package.json` file:
``` ```
### Inputs ### Inputs
| Input Parameter | Required | Description | | Input Parameter | Required | Description |
|:----------------:|:--------:|-------------| |:-----------------:|:--------:|-------------|
| semantic_version | false | Specify specifying version range for semantic-release. [[Details](#semantic_version)] | | semantic_version | false | Specify specifying version range for semantic-release. [[Details](#semantic_version)] |
| branches | false | The branches on which releases should happen.[[Details](#branches)]<br>Support for **semantic-release above v16**. | | branches | false | The branches on which releases should happen.[[Details](#branches)]<br>Support for **semantic-release above v16**. |
| branch | false | The branch on which releases should happen.[[Details](#branch)]<br>Only support for **semantic-release older than v16**. | | branch | false | The branch on which releases should happen.[[Details](#branch)]<br>Only support for **semantic-release older than v16**. |
| extra_plugins | false | Extra plugins for pre-install. [[Details](#extra_plugins)] | | extra_plugins | false | Extra plugins for pre-install. [[Details](#extra_plugins)] |
| dry_run | false | Whether to run semantic release in `dry-run` mode. [[Details](#dry_run)] | | dry_run | false | Whether to run semantic release in `dry-run` mode. [[Details](#dry_run)] |
| extends | false | Use a sharable configuration [[Details](#extends)] | | extends | false | Use a sharable configuration [[Details](#extends)] |
| working_directory | false | Use another working directory for semantic release [[Details](#working_directory)] |
#### semantic_version #### semantic_version
> {Optional Input Parameter} Specify specifying version range for semantic-release.<br>If no version range is specified, latest version will be used by default. > {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:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
``` ```
#### working_directory
This action run semantic release in the github provided workspace by default. You can override it by setting another working directory.
```yaml
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
with:
# You can select another working directory like a subdirectory for example.
working_directory: ./code
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
```
### Outputs ### Outputs
| Output Parameter | Description | | Output Parameter | Description |
|:-------------------------:|---| |:-------------------------:|---|

View file

@ -23,6 +23,9 @@ inputs:
extends: extends:
required: false required: false
description: 'One or several sharable configurations, https://semantic-release.gitbook.io/semantic-release/usage/configuration#extends' description: 'One or several sharable configurations, https://semantic-release.gitbook.io/semantic-release/usage/configuration#extends'
working_directory:
required: false
description: 'Specify another working directory for semantic release. Default one is provided by github.'
outputs: outputs:
new_release_published: new_release_published:
description: 'Whether a new release was published' description: 'Whether a new release was published'

View file

@ -16,6 +16,9 @@ const inputs = require('./inputs.json');
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
const release = async () => { const release = async () => {
if (core.getInput(inputs.working_directory)) {
process.chdir(core.getInput(inputs.working_directory));
}
await setUpJob(); await setUpJob();
await installSpecifyingVersionSemantic(); await installSpecifyingVersionSemantic();
await preInstall(core.getInput(inputs.extra_plugins)); await preInstall(core.getInput(inputs.extra_plugins));

View file

@ -4,5 +4,6 @@
"branch": "branch", "branch": "branch",
"extra_plugins": "extra_plugins", "extra_plugins": "extra_plugins",
"dry_run": "dry_run", "dry_run": "dry_run",
"extends": "extends" "extends": "extends",
"working_directory": "working_directory"
} }