mirror of
https://github.com/cycjimmy/semantic-release-action.git
synced 2025-11-07 18:56:56 +00:00
Merge pull request #154 from dezkareid/feat/tag-format
feat: input tag format
This commit is contained in:
commit
193a3b9349
5 changed files with 40 additions and 1 deletions
17
README.md
17
README.md
|
|
@ -52,6 +52,7 @@ then make sure that you configure this in your `package.json` file:
|
||||||
| 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)] |
|
| working_directory | false | Use another working directory for semantic release [[Details](#working_directory)] |
|
||||||
|
| tag_format | false | Specify format of tag (useful for monorepos) |
|
||||||
|
|
||||||
#### semantic_version
|
#### semantic_version
|
||||||
> {Optional Input Parameter} Specify version range for semantic-release.
|
> {Optional Input Parameter} Specify version range for semantic-release.
|
||||||
|
|
@ -229,6 +230,22 @@ steps:
|
||||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### tag_format
|
||||||
|
The default tag format on semantic-release is `v{version}`. You can override that behavior using this option (helpful when you are using monorepos)
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Semantic Release
|
||||||
|
uses: cycjimmy/semantic-release-action@v3
|
||||||
|
with:
|
||||||
|
tag_format: custom-v{version}
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
```
|
||||||
|
|
||||||
### Outputs
|
### Outputs
|
||||||
| Output Parameter | Description |
|
| Output Parameter | Description |
|
||||||
|:-------------------------:|-----------------------------------------------------------------------------------------------------------------------------------|
|
|:-------------------------:|-----------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,9 @@ inputs:
|
||||||
working_directory:
|
working_directory:
|
||||||
required: false
|
required: false
|
||||||
description: 'Specify another working directory for semantic release. Default one is provided by github.'
|
description: 'Specify another working directory for semantic release. Default one is provided by github.'
|
||||||
|
tag_format:
|
||||||
|
required: false
|
||||||
|
description: 'The default tag format on semantic-release is v{version}. You can override that behavior using this option.'
|
||||||
outputs:
|
outputs:
|
||||||
new_release_published:
|
new_release_published:
|
||||||
description: 'Whether a new release was published'
|
description: 'Whether a new release was published'
|
||||||
|
|
|
||||||
|
|
@ -77,3 +77,19 @@ exports.handleExtends = () => {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle TagFormat Option
|
||||||
|
* @returns {{}|{tagFormat: String}}
|
||||||
|
*/
|
||||||
|
exports.handleTagFormat = () => {
|
||||||
|
const tagFormat = core.getInput(inputs.tag_format);
|
||||||
|
|
||||||
|
if (tagFormat) {
|
||||||
|
return {
|
||||||
|
tagFormat
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ const {
|
||||||
handleBranchesOption,
|
handleBranchesOption,
|
||||||
handleDryRunOption,
|
handleDryRunOption,
|
||||||
handleExtends,
|
handleExtends,
|
||||||
|
handleTagFormat,
|
||||||
} = require('./handleOptions');
|
} = require('./handleOptions');
|
||||||
const setUpJob = require('./setUpJob.task');
|
const setUpJob = require('./setUpJob.task');
|
||||||
const installSpecifyingVersionSemantic = require('./installSpecifyingVersionSemantic.task');
|
const installSpecifyingVersionSemantic = require('./installSpecifyingVersionSemantic.task');
|
||||||
|
|
@ -29,6 +30,7 @@ const release = async () => {
|
||||||
...handleBranchesOption(),
|
...handleBranchesOption(),
|
||||||
...handleDryRunOption(),
|
...handleDryRunOption(),
|
||||||
...handleExtends(),
|
...handleExtends(),
|
||||||
|
...handleTagFormat()
|
||||||
});
|
});
|
||||||
|
|
||||||
await cleanupNpmrc();
|
await cleanupNpmrc();
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,6 @@
|
||||||
"extra_plugins": "extra_plugins",
|
"extra_plugins": "extra_plugins",
|
||||||
"dry_run": "dry_run",
|
"dry_run": "dry_run",
|
||||||
"extends": "extends",
|
"extends": "extends",
|
||||||
"working_directory": "working_directory"
|
"working_directory": "working_directory",
|
||||||
|
"tag_format": "tag_format"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue