Skip to content
Snippets Groups Projects
Commit b7b2e0a4 authored by Simon Weimann's avatar Simon Weimann Committed by Pierre Smeyers
Browse files

feat: add inputs to overwrite plugins used in default config


This commit adds the ability to overwrite the semantic-release
plugins used in the generated default config. The values can be
controlled using component inputs.

Signed-off-by: default avatarWeimann, Simon <simon.weimann@ruv.de>
parent 90c70487
No related branches found
No related tags found
No related merge requests found
...@@ -86,7 +86,7 @@ If no configuration is found, the template will generate one with the following ...@@ -86,7 +86,7 @@ If no configuration is found, the template will generate one with the following
As specified in the previous chapter, these variables are only used to generated a `.releaserc` when no configuration is found in the repository. As specified in the previous chapter, these variables are only used to generated a `.releaserc` when no configuration is found in the repository.
| Input / Variable | Description | Default value | | Input / Variable | Description | Default value |
| ------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | | -------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| `changelog-enabled` / `SEMREL_CHANGELOG_ENABLED` | Add the [@semantic-release/changelog](https://github.com/semantic-release/changelog) plugin which will commit a changelog file in the repository if set to `true`. | _none_ | | `changelog-enabled` / `SEMREL_CHANGELOG_ENABLED` | Add the [@semantic-release/changelog](https://github.com/semantic-release/changelog) plugin which will commit a changelog file in the repository if set to `true`. | _none_ |
| `changelog-file` / `SEMREL_CHANGELOG_FILE` | [changelogFile @semantic-release/changelog option](https://github.com/semantic-release/changelog#options). | _none_ (use the plugin default value which is `CHANGELOG.md`). | | `changelog-file` / `SEMREL_CHANGELOG_FILE` | [changelogFile @semantic-release/changelog option](https://github.com/semantic-release/changelog#options). | _none_ (use the plugin default value which is `CHANGELOG.md`). |
| `changelog-title` / `SEMREL_CHANGELOG_TITLE` | [changelogTitle @semantic-release/changelog option](https://github.com/semantic-release/changelog#options). You might want to use markdown format (for example `# MyApp Changelog`). | _none_ | | `changelog-title` / `SEMREL_CHANGELOG_TITLE` | [changelogTitle @semantic-release/changelog option](https://github.com/semantic-release/changelog#options). You might want to use markdown format (for example `# MyApp Changelog`). | _none_ |
...@@ -98,6 +98,12 @@ As specified in the previous chapter, these variables are only used to generated ...@@ -98,6 +98,12 @@ As specified in the previous chapter, these variables are only used to generated
| `hooks-dir` / `SEMREL_HOOKS_DIR` | [Hook scripts](#hook_scripts) folder. | `.` | | `hooks-dir` / `SEMREL_HOOKS_DIR` | [Hook scripts](#hook_scripts) folder. | `.` |
| `commit-message` / `SEMREL_COMMIT_MESSAGE` | Add a custom commit message based on [semantic-release/git option](https://github.com/semantic-release/git#message). | _none_ (uses semantic-release default commit message) | | `commit-message` / `SEMREL_COMMIT_MESSAGE` | Add a custom commit message based on [semantic-release/git option](https://github.com/semantic-release/git#message). | _none_ (uses semantic-release default commit message) |
| `release-disabled` / `SEMREL_RELEASE_DISABLED` | Disable this job. | _none_ | | `release-disabled` / `SEMREL_RELEASE_DISABLED` | Disable this job. | _none_ |
| `commit-analyzer-plugin` / `SEMREL_COMMIT_ANALYZER_PLUGIN` | NPM plugin name for the [commit-analyzer](https://github.com/semantic-release/commit-analyzer#commit-analyzer) plugin | `@semantic-release/commit-analyzer` |
| `release-notes-generator-plugin` / `SEMREL_RELEASE_NOTES_GENERATOR_PLUGIN` | NPM plugin name for the [release-notes-generator](https://github.com/semantic-release/release-notes-generator#release-notes-generator) plugin | `@semantic-release/release-notes-generator` |
| `gitlab-plugin` / `SEMREL_GITLAB_PLUGIN` | NPM plugin name for the [gitlab](https://github.com/semantic-release/gitlab#semantic-releasegitlab) plugin | `@semantic-release/gitlab` |
| `changelog-plugin` / `SEMREL_CHANGELOG_PLUGIN` | NPM plugin name for the [changelog](https://github.com/semantic-release/changelog#semantic-releasechangelog) plugin | `@semantic-release/changelog` |
| `git-plugin` / `SEMREL_GIT_PLUGIN` | NPM plugin name for the [git](https://github.com/semantic-release/git#semantic-releasegit) plugin | `@semantic-release/git` |
| `exec-plugin` / `SEMREL_EXEC_PLUGIN` | NPM plugin name for the [exec](https://github.com/semantic-release/exec#semantic-releaseexec) plugin | `@semantic-release/exec` |
#### Hook scripts #### Hook scripts
......
...@@ -117,6 +117,42 @@ ...@@ -117,6 +117,42 @@
"values": ["angular","codemirror","conventionalcommits","ember","eslint","express","jquery","jshint"], "values": ["angular","codemirror","conventionalcommits","ember","eslint","express","jquery","jshint"],
"default": "angular", "default": "angular",
"advanced": true "advanced": true
},
{
"name": "SEMREL_COMMIT_ANALYZER_PLUGIN",
"description": "NPM plugin name for the commit-analyzer plugin.",
"default": "@semantic-release/commit-analyzer",
"advanced": true
},
{
"name": "SEMREL_RELEASE_NOTES_GENERATOR_PLUGIN",
"description": "NPM plugin name for the release-notes-generator plugin.",
"default": "@semantic-release/release-notes-generator",
"advanced": true
},
{
"name": "SEMREL_GITLAB_PLUGIN",
"description": "NPM plugin name for the gitlab plugin.",
"default": "@semantic-release/gitlab",
"advanced": true
},
{
"name": "SEMREL_CHANGELOG_PLUGIN",
"description": "NPM plugin name for the changelog plugin.",
"default": "@semantic-release/changelog",
"advanced": true
},
{
"name": "SEMREL_GIT_PLUGIN",
"description": "NPM plugin name for the git plugin.",
"default": "@semantic-release/git",
"advanced": true
},
{
"name": "SEMREL_EXEC_PLUGIN",
"description": "NPM plugin name for the exec plugin.",
"default": "@semantic-release/exec",
"advanced": true
} }
] ]
}, },
......
...@@ -89,6 +89,25 @@ spec: ...@@ -89,6 +89,25 @@ spec:
- protected - protected
- all - all
default: '' default: ''
commit-analyzer-plugin:
description: The npm plugin name for the commit-analyzer plugin. The default is `@semantic-release/commit-analyzer`
default: '@semantic-release/commit-analyzer'
release-notes-generator-plugin:
description: The npm plugin name for the release-notes-generator plugin. The default is `@semantic-release/release-notes-generator`
default: '@semantic-release/release-notes-generator'
gitlab-plugin:
description: The npm plugin name for the gitlab plugin. The default is `@semantic-release/gitlab`
default: '@semantic-release/gitlab'
changelog-plugin:
description: The npm plugin name for the changelog plugin. The default is `@semantic-release/changelog`
default: '@semantic-release/changelog'
git-plugin:
description: The npm plugin name for the git plugin. The default is `@semantic-release/git`
default: '@semantic-release/git'
exec-plugin:
description: The npm plugin name for the exec plugin. The default is `@semantic-release/exec`
default: '@semantic-release/exec'
--- ---
workflow: workflow:
rules: rules:
...@@ -144,6 +163,13 @@ variables: ...@@ -144,6 +163,13 @@ variables:
SEMREL_INFO_ON: $[[ inputs.info-on ]] SEMREL_INFO_ON: $[[ inputs.info-on ]]
SEMREL_COMMIT_SPEC: $[[ inputs.commit-spec ]] SEMREL_COMMIT_SPEC: $[[ inputs.commit-spec ]]
SEMREL_COMMIT_ANALYZER_PLUGIN: $[[ inputs.commit-analyzer-plugin ]]
SEMREL_RELEASE_NOTES_GENERATOR_PLUGIN: $[[ inputs.release-notes-generator-plugin ]]
SEMREL_GITLAB_PLUGIN: $[[ inputs.gitlab-plugin ]]
SEMREL_CHANGELOG_PLUGIN: $[[ inputs.changelog-plugin ]]
SEMREL_GIT_PLUGIN: $[[ inputs.git-plugin ]]
SEMREL_EXEC_PLUGIN: $[[ inputs.exec-plugin ]]
# default production ref name (pattern) # default production ref name (pattern)
PROD_REF: /^(master|main)$/ PROD_REF: /^(master|main)$/
SEMREL_BRANCHES_REF: $[[ inputs.branches-ref ]] SEMREL_BRANCHES_REF: $[[ inputs.branches-ref ]]
...@@ -506,11 +532,11 @@ stages: ...@@ -506,11 +532,11 @@ stages:
echo "tagFormat: '${SEMREL_TAG_FORMAT}'" echo "tagFormat: '${SEMREL_TAG_FORMAT}'"
echo "" echo ""
echo "plugins: " echo "plugins: "
echo " - - '@semantic-release/commit-analyzer'" echo " - - '${SEMREL_COMMIT_ANALYZER_PLUGIN}'"
echo "${commitPresetConfig}" echo "${commitPresetConfig}"
echo " - - '@semantic-release/release-notes-generator'" echo " - - '${SEMREL_RELEASE_NOTES_GENERATOR_PLUGIN}'"
echo "${commitPresetConfig}" echo "${commitPresetConfig}"
echo " - '@semantic-release/gitlab'" echo " - '${SEMREL_GITLAB_PLUGIN}'"
echo "${changelogPluginConfig}" echo "${changelogPluginConfig}"
echo "${execPluginConfig}" echo "${execPluginConfig}"
echo "${gitPluginConfig}" echo "${gitPluginConfig}"
...@@ -583,10 +609,10 @@ stages: ...@@ -583,10 +609,10 @@ stages:
if [[ -n "${SEMREL_CHANGELOG_TITLE}" ]]; then if [[ -n "${SEMREL_CHANGELOG_TITLE}" ]]; then
changeLogConfig=$(echo -e "${changeLogConfig:+${changeLogConfig}\n }changelogTitle: '${SEMREL_CHANGELOG_TITLE}'") changeLogConfig=$(echo -e "${changeLogConfig:+${changeLogConfig}\n }changelogTitle: '${SEMREL_CHANGELOG_TITLE}'")
fi fi
echo " - - '@semantic-release/changelog'" echo " - - '${SEMREL_CHANGELOG_PLUGIN}'"
echo " - ${changeLogConfig}" echo " - ${changeLogConfig}"
else else
echo " - '@semantic-release/changelog'" echo " - '${SEMREL_CHANGELOG_PLUGIN}'"
fi fi
else else
echo "" echo ""
...@@ -597,7 +623,7 @@ stages: ...@@ -597,7 +623,7 @@ stages:
function generate_git_plugin_conf() { function generate_git_plugin_conf() {
# git plugin has default changelog file as asset by default so # git plugin has default changelog file as asset by default so
# we need to add it explicitly if the user configured a custom changelogFile # we need to add it explicitly if the user configured a custom changelogFile
echo " - - '@semantic-release/git'" echo " - - '${SEMREL_GIT_PLUGIN}'"
if [[ "${SEMREL_CHANGELOG_ENABLED}" = "true" ]] && [[ -n "${SEMREL_CHANGELOG_FILE}" ]]; then if [[ "${SEMREL_CHANGELOG_ENABLED}" = "true" ]] && [[ -n "${SEMREL_CHANGELOG_FILE}" ]]; then
echo " - assets:" echo " - assets:"
echo " - '${SEMREL_CHANGELOG_FILE}'" echo " - '${SEMREL_CHANGELOG_FILE}'"
...@@ -655,7 +681,7 @@ stages: ...@@ -655,7 +681,7 @@ stages:
tabs=" " tabs=" "
fi fi
if [[ -n "${scriptsConfig}" ]]; then if [[ -n "${scriptsConfig}" ]]; then
echo " - - '@semantic-release/exec'" echo " - - '${SEMREL_EXEC_PLUGIN}'"
echo "${scriptsConfig}" echo "${scriptsConfig}"
else else
echo "" echo ""
...@@ -729,9 +755,9 @@ stages: ...@@ -729,9 +755,9 @@ stages:
echo "# injected (replace your plugins) plugins by the template to generate dotenv" echo "# injected (replace your plugins) plugins by the template to generate dotenv"
echo "" echo ""
echo "plugins:" echo "plugins:"
echo " - - '@semantic-release/commit-analyzer'" echo " - - '${SEMREL_COMMIT_ANALYZER_PLUGIN}'"
echo "${commitPresetConfig}" echo "${commitPresetConfig}"
echo " - - '@semantic-release/exec'" echo " - - '${SEMREL_EXEC_PLUGIN}'"
echo " - analyzeCommitsCmd: '\"${export_last_version_hook_script}\" \"\${lastRelease.version}\"'" echo " - analyzeCommitsCmd: '\"${export_last_version_hook_script}\" \"\${lastRelease.version}\"'"
echo " verifyReleaseCmd: '\"${export_next_version_hook_script}\" \"\${nextRelease.version}\" \"\${nextRelease.type}\"'" echo " verifyReleaseCmd: '\"${export_next_version_hook_script}\" \"\${nextRelease.version}\" \"\${nextRelease.type}\"'"
echo "" echo ""
...@@ -744,7 +770,7 @@ stages: ...@@ -744,7 +770,7 @@ stages:
cat ".releaserc" cat ".releaserc"
fi fi
npm install --global "semantic-release@${SEMREL_VERSION}" "@semantic-release/exec@${SEMREL_EXEC_VERSION}" npm install --global "semantic-release@${SEMREL_VERSION}" "${SEMREL_EXEC_PLUGIN}@${SEMREL_EXEC_VERSION}"
semantic-release --dry-run semantic-release --dry-run
# Rollback temporary semantic-release configuration # Rollback temporary semantic-release configuration
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment