Commit 6b38d5bc authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

feat: allow to specify sem-rel and plugins version

parent 6cd387fc
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@ The semantic-release template uses some global configuration used throughout all
| Name                  | description                                   | default value     |
| --------------------- | --------------------------------------------- | ----------------- |
| `SEMREL_IMAGE`        | The Docker image used to run semantic-release | `registry.hub.docker.com/library/node:latest` |
| `SEMREL_VERSION`      | The [semantic-release](https://www.npmjs.com/package/semantic-release) version to use | `latest` |
| `SEMREL_EXEC_VERSION` | The [@semantic-release/exec](https://www.npmjs.com/package/@semantic-release/exec) version to use | `latest` |
| :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_ |
| `GIT_AUTHOR_EMAIL` | A Git author email address associated with the `GITLAB_TOKEN` [bot user](https://docs.gitlab.com/ee/user/project/settings/project_access_tokens.html#bot-users-for-projects). This is [defined by `semantic-release`](https://semantic-release.gitbook.io/semantic-release/usage/configuration#git-environment-variables) itself, and **required if** the [verify-user push rules](https://docs.gitlab.com/ee/user/project/repository/push_rules.html#verify-users) enabled for the project | _none_ |
| `GIT_COMMITTER_EMAIL` | A Git committer email address associated with the `GITLAB_TOKEN` [bot user](https://docs.gitlab.com/ee/user/project/settings/project_access_tokens.html#bot-users-for-projects). This is [defined by `semantic-release`](https://semantic-release.gitbook.io/semantic-release/usage/configuration#git-environment-variables) itself, and **required if** the [verify-user push rules](https://docs.gitlab.com/ee/user/project/repository/push_rules.html#verify-users) enabled for the project | _none_ |
+12 −0
Original line number Diff line number Diff line
@@ -9,6 +9,18 @@
      "description": "The Docker image used to run semantic-release",
      "default": "registry.hub.docker.com/library/node:latest"
    },
    {
      "name": "SEMREL_VERSION",
      "description": "The [semantic-release](https://www.npmjs.com/package/semantic-release) version to use",
      "default": "latest",
      "advanced": true
    },
    {
      "name": "SEMREL_EXEC_VERSION",
      "description": "The [@semantic-release/exec](https://www.npmjs.com/package/@semantic-release/exec) version to use",
      "default": "latest",
      "advanced": true
    },
    {
      "name": "GITLAB_TOKEN",
      "description": "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.",
+4 −2
Original line number Diff line number Diff line
@@ -44,6 +44,8 @@ variables:
  SEMREL_PUBLISH_CMD: "publish.sh"
  SEMREL_SUCCESS_CMD: "success.sh"
  SEMREL_FAIL_CMD: "fail.sh"
  SEMREL_VERSION: latest
  SEMREL_EXEC_VERSION: latest

  SEMREL_CONFIG_DIR: "."

@@ -369,7 +371,7 @@ stages:
    done <<< $(yq eval ".plugins[]" "${semrelConfigFile}" -o=json --indent 0)

    # shellcheck disable=SC2086
    npm install -g semantic-release ${required_plugins}
    npm install -g "semantic-release@${SEMREL_VERSION}" ${required_plugins}
  }

  # this script console output is inserted in generated file: DO NOT ADD LOGS
@@ -528,7 +530,7 @@ stages:
      cat ".releaserc"
    fi

    npm install -g semantic-release @semantic-release/exec
    npm install -g "semantic-release@${SEMREL_VERSION}" "@semantic-release/exec@${SEMREL_EXEC_VERSION}"
    semantic-release --dry-run

    # Rollback temporary semantic-release configuration