diff --git a/README.md b/README.md index 1da2a20..4632da4 100644 --- a/README.md +++ b/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)] | | extends | false | Use a sharable configuration [[Details](#extends)] | | 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 > {Optional Input Parameter} Specify version range for semantic-release. @@ -229,6 +230,22 @@ steps: 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 | Output Parameter | Description | |:-------------------------:|-----------------------------------------------------------------------------------------------------------------------------------| diff --git a/action.yml b/action.yml index c6c3243..1faed9b 100644 --- a/action.yml +++ b/action.yml @@ -26,6 +26,9 @@ inputs: working_directory: required: false 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: new_release_published: description: 'Whether a new release was published' diff --git a/src/handleOptions.js b/src/handleOptions.js index 1c59815..92f4c9b 100644 --- a/src/handleOptions.js +++ b/src/handleOptions.js @@ -77,3 +77,19 @@ exports.handleExtends = () => { return {}; } }; + +/** + * Handle TagFormat Option + * @returns {{}|{tagFormat: String}} + */ +exports.handleTagFormat = () => { + const tagFormat = core.getInput(inputs.tag_format); + + if (tagFormat) { + return { + tagFormat + }; + } else { + return {}; + } +}; diff --git a/src/index.js b/src/index.js index 01d112d..7fe1bdc 100644 --- a/src/index.js +++ b/src/index.js @@ -3,6 +3,7 @@ const { handleBranchesOption, handleDryRunOption, handleExtends, + handleTagFormat, } = require('./handleOptions'); const setUpJob = require('./setUpJob.task'); const installSpecifyingVersionSemantic = require('./installSpecifyingVersionSemantic.task'); @@ -29,6 +30,7 @@ const release = async () => { ...handleBranchesOption(), ...handleDryRunOption(), ...handleExtends(), + ...handleTagFormat() }); await cleanupNpmrc(); diff --git a/src/inputs.json b/src/inputs.json index 74a84b9..2b83ebe 100644 --- a/src/inputs.json +++ b/src/inputs.json @@ -5,5 +5,6 @@ "extra_plugins": "extra_plugins", "dry_run": "dry_run", "extends": "extends", - "working_directory": "working_directory" + "working_directory": "working_directory", + "tag_format": "tag_format" }