Commit 6a92c1ff authored by Cédric OLIVIER's avatar Cédric OLIVIER
Browse files

Merge branch 'gl-10' into 'master'

feat: allow to install additional npm package

Closes #10

See merge request to-be-continuous/semantic-release!11
parents e45a615d 561c3323
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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

+6 −0
Original line number Diff line number Diff line
@@ -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": [
+11 −1
Original line number Diff line number Diff line
@@ -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