Skip to content
Snippets Groups Projects
Commit 561c3323 authored by Sébastien CROCQUESEL's avatar Sébastien CROCQUESEL Committed by Cédric OLIVIER
Browse files

feat: allow to install additional npm package

parent e45a615d
No related branches found
Tags 3.11.3
No related merge requests found
......@@ -23,6 +23,9 @@ The semantic-release template uses some global configuration used throughout all
| --------------------- | --------------------------------------------- | ----------------- |
| `SEMREL_IMAGE` | The Docker image used to run semantic-release | `node:lts` |
| :lock: `GITLAB_TOKEN` | A GitLab [project access token](https://docs.gitlab.com/ee/user/project/settings/project_access_tokens.html) or [personal access token](https://docs.gitlab.com/ce/user/profile/personal_access_tokens.html) with `api`, `read_repository` and `write repository` scopes. :warning: This variable is **mandatory** and [defined by `semantic-release`](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/ci-configuration.md#push-access-to-the-remote-repository) itself. | _none_ |
| `SEMREL_REQUIRED_PLUGINS_FILE` | An optional file for additional npm packages to install | `semrel-required-plugins.txt` |
Jobs will extract required plugin packages from discovered configuration. If your configuration needs additional packages, add them, one per line, to `SEMREL_REQUIRED_PLUGINS_FILE` file. Each line must be a valid `npm install` package argument.
## Jobs
......
......@@ -20,6 +20,12 @@
"description": "For generated `.releaserc` file only. [tagFormat semantic-release option](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#tagformat)e. :warning: don't forget to double the `$` character so it is not interpreted by GitLab.",
"default": "$${version}",
"advanced": true
},
{
"name": "SEMREL_REQUIRED_PLUGINS_FILE",
"description": "Full path to `semrel-required-plugins.txt` file _(relative to `$CI_PROJECT_DIR`)_",
"default": "semrel-required-plugins.txt",
"advanced": true
}
],
"features": [
......
......@@ -24,6 +24,8 @@ variables:
# default production ref name (pattern)
PROD_REF: '/^(master|main)$/'
SEMREL_REQUIRED_PLUGINS_FILE: "semrel-required-plugins.txt"
# undocumented (for internal use only)
SEMREL_VERIFY_CONDITIONS_CMD: "verify-conditions.sh"
SEMREL_VERIFY_RELEASE_CMD: "verify-release.sh"
......@@ -31,7 +33,7 @@ variables:
SEMREL_PUBLISH_CMD: "publish.sh"
SEMREL_SUCCESS_CMD: "success.sh"
SEMREL_FAIL_CMD: "fail.sh"
SEMREL_REQUIRED_PLUGINS_FILE: "semrel-required-plugins.txt"
stages:
- publish
......@@ -331,6 +333,14 @@ stages:
log_info "installing required plugins"
# shellcheck disable=SC2046
if [[ -f "${SEMREL_REQUIRED_PLUGINS_FILE}" ]]; then
while IFS= read -r line || [[ -n "$line" ]]
do
required_plugins="${required_plugins} $line"
done <<< $(cat "${SEMREL_REQUIRED_PLUGINS_FILE}")
fi
# shellcheck disable=SC2046
while IFS= read -r line || [[ -n "$line" ]]
do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment