1.0.5 • Published 7 months ago

semantic-release-additional-tags v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

semantic-release-additional-tags

A plugin for semantic-relese inspired by semantic-release-major-tag but with the added option to set tags via the gitlab api to support the reuse of protected tags

Supported Steps

verifyConditions

Verifies the provided additionalTags and tests the gitlab credentials if gitlab is enabled

success

Adds the additional tags to the provided commit

Installation

npm i --save-dev semantic-release-additional-tags

or

yarn add -D semantic-release-additional-tags

And follow the configuration below

Configuration

Every option can be set using Environment variable or the plugin config

Example:

{
  "plugins": [
    ["semantic-release-additional-tags", {
            
      }
    ]
  ]
}
Config OptionEnvironment variableRequiredDefaultDescription
additionalTags-Yes[]String array containing the additional tags with possible variables ${major}, ${minor}, ${patcg}. Ex.: v${major}.latest
useGitlabApiADDITIONAL_TAGS_GITLABNofalseOption to enable the use of the gitlab api to support retagging of protected tags
gitlabTokenGL_TOKEN or GITLAB_TOKENwhen gitlab api is used-Gitlab api token, with permissions to create/delete tags
commitShaCI_COMMIT_SHAwhen gitlab api is used-The referenced commit to be tagged, by default provided by gitlab_ci
-CI_API_V4_URLNo-URL of the v4 api endpoint of gitlab, by default provided by gitlab ci
gitlabUrlGITLAB_URLNohttps://gitlab.comBase url of the used gitlab instance if CI_API_V4_URL is not set

Example CI Config

Gitlab

stages:
  - semantic-release
semantic-release:
  stage: semantic-release
  image: node
  before_script:
    - npm install semantic-release
    - npm install @semantic-release/git
    - npm install @semantic-release/gitlab    
    - npm install semantic-release-additional-tags
  script:
     # Gitlab CI Variables already set in project settings
     # GL_TOKEN
    - |
      cat > .releaserc << EOF
      {
        "branches": ["master", "main"],
        "debug": true,
        "plugins": [
          "@semantic-release/commit-analyzer",
          "@semantic-release/gitlab",
          ["semantic-release-additional-tags", {
            "useGitlabApi": true,
            "additionalTags": ["latest", "v${major}.latest", "$v{major}.${minor}.latest"]
          }]
        ]
      }
      EOF
    - semantic-release
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH 
      when: always
1.0.5

7 months ago

1.0.4

9 months ago

1.0.3

12 months ago

1.0.2

1 year ago

1.0.1

2 years ago

1.0.0

2 years ago