5
0
Fork 0
mirror of https://github.com/cycjimmy/semantic-release-action.git synced 2025-11-14 05:53:46 +00:00

feat: add extends parameter

This commit is contained in:
Zadkiel 2020-01-02 15:18:45 +01:00
parent 16d8f3d61d
commit c1d4f0cca8
No known key found for this signature in database
GPG key ID: C93C54450571DC32
5 changed files with 23 additions and 2 deletions

View file

@ -21,6 +21,7 @@ GitHub Action for [Semantic Release](https://github.com/semantic-release/semanti
* `semantic_version`: [Optional] Specify specifying version range for semantic-release. If no version range is specified, semantic-release@^15 will be used by default. * `semantic_version`: [Optional] Specify specifying version range for semantic-release. If no version range is specified, semantic-release@^15 will be used by default.
* `extra_plugins`: [Optional] Extra plugins for pre-install. You can also specify specifying version range for the extra plugins if you prefer. * `extra_plugins`: [Optional] Extra plugins for pre-install. You can also specify specifying version range for the extra plugins if you prefer.
* `dry_run`: [Optional] Whether to run semantic release in `dry-run` mode. It will override the dryRun attribute in your configuration file. * `dry_run`: [Optional] Whether to run semantic release in `dry-run` mode. It will override the dryRun attribute in your configuration file.
* `extends`: [Optional] Shareable configuration to use. It will override the extends attribute in your configuration file.
* outputs: * outputs:
* `new_release_published`: Whether a new release was published. `true` or `false` * `new_release_published`: Whether a new release was published. `true` or `false`
* `new_release_version`: Version of the new release * `new_release_version`: Version of the new release
@ -55,6 +56,7 @@ steps:
extra_plugins: | extra_plugins: |
@semantic-release/git @semantic-release/git
@semantic-release/changelog@3.0.0 @semantic-release/changelog@3.0.0
extends: .github/release.config.js
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

View file

@ -13,6 +13,8 @@ inputs:
description: 'Extra plugins for pre-install. You can also specify specifying version range for the extra plugins if you prefer.' description: 'Extra plugins for pre-install. You can also specify specifying version range for the extra plugins if you prefer.'
dry_run: dry_run:
description: 'Whether to run semantic release in `dry-run` mode. It will override the dryRun attribute in your configuration file' description: 'Whether to run semantic release in `dry-run` mode. It will override the dryRun attribute in your configuration file'
extends:
description: 'Shareable configuration to use. It will override the extends attribute in your configuration file.'
outputs: outputs:
new_release_published: new_release_published:
description: 'Whether a new release was published' description: 'Whether a new release was published'

View file

@ -34,3 +34,18 @@ exports.handleDryRunOption = () => {
return {}; return {};
} }
}; };
/**
* Handle Extends Option
* @returns {{}|{extends: string}}
*/
exports.handleExtendsOption = () => {
const extendsOption = {};
const extends = core.getInput(inputs.extends);
if (extends) {
extendsOption.extends = extends;
}
return extendsOption;
};

View file

@ -1,5 +1,5 @@
const core = require('@actions/core'); const core = require('@actions/core');
const {handleBranchOption, handleDryRunOption} = require('./handleOptions'); const {handleBranchOption, handleDryRunOption, handleExtendsOption} = require('./handleOptions');
const setUpJob = require('./setUpJob.task'); const setUpJob = require('./setUpJob.task');
const installSpecifyingVersionSemantic = require('./installSpecifyingVersionSemantic.task'); const installSpecifyingVersionSemantic = require('./installSpecifyingVersionSemantic.task');
const preInstallPlugins = require('./preInstallPlugins.task'); const preInstallPlugins = require('./preInstallPlugins.task');
@ -19,6 +19,7 @@ const release = async () => {
const result = await semanticRelease({ const result = await semanticRelease({
...(handleBranchOption()), ...(handleBranchOption()),
...(handleDryRunOption()), ...(handleDryRunOption()),
...(handleExtendsOption()),
}); });
await cleanupNpmrc(); await cleanupNpmrc();

View file

@ -2,5 +2,6 @@
"branch": "branch", "branch": "branch",
"semantic_version": "semantic_version", "semantic_version": "semantic_version",
"extra_plugins": "extra_plugins", "extra_plugins": "extra_plugins",
"dry_run": "dry_run" "dry_run": "dry_run",
"extends": "extends"
} }