Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

semantic-release-ado

semantic-release Build Status

Semantic release plugin for automatic builds on Azure DevOps pipelines.

Step Description
analyzeCommits If configured to do so, stores the current version as an Azure DevOps pipeline variable.
prepare Stores the next version as an Azure DevOps pipeline variable availabe to downstream steps on the job.

Install

$ npm install -D semantic-release-ado

Usage

The plugin can be configured in the semantic-release configuration file:

YAML:

plugins:
  - @semantic-release-ado"

JSON:

{
  "plugins": [
    "semantic-release-ado",
  ]
}

The generated version number will be stored on a variable availabe to downstream steps on the job. By default this variable is named nextRelease, but the name can be configured in the plugin options. The behavior when no new release is available can be configured with setOnlyOnRelease.

Configuration

Options

Options Desctiption
varName Name of the variable that will store the next version. Defaults to nextRelease.
setOnlyOnRelease Bool. Determines if the variable with the new version will be set only when a new version is available.
If set to false, the next version variable will store the last released version when no new version is available.
Defaults to true.

The following examples store the generated version number in a variable named version.

YAML:

plugins:
  - - "semantic-release-ado"
    - varName: "version"
    - setOnlyOnRelease: true

JSON:

{
  "plugins": [
    ["semantic-release-ado", {
      "varName": "version",
      "setOnlyOnRelease": true
    }],
  ]
}

Azure DevOps build pipeline YAML example:

Using the variable on the seme job:

jobs:
- job: Build
  pool:
    vmImage: 'vs2017-win2016'
  steps:

  - script: >
      npx -p semantic-release
      -p @semantic-release/git
      -p semantic-release-ado
      semantic-release
    env: { GH_TOKEN: $(GitHubToken) }
    displayName: 'Semantic release'

  - script: echo $(nextRelease)
    displayName: 'Show next version'

Using the variable on a later job:

jobs:
- job: Job1
  pool:
    vmImage: 'vs2017-win2016'

  steps:
  - script: >
      npx -p semantic-release
      -p @semantic-release/git
      -p semantic-release-ado
      semantic-release
    env: { GH_TOKEN: $(GitHubToken) }
    displayName: 'Semantic release'

  - powershell: |
      echo "##vso[task.setvariable variable=versionNumber;isOutput=true]$(nextRelease)"
    name: setOutputVar

- job: Job2
  dependsOn: Job1
  pool:
    vmImage: 'vs2017-win2016'
  variables:
    versionNumber: $[ dependencies.Job1.outputs['setOutputVar.versionNumber'] ]

  steps:
  - script: echo $(versionNumber)
    displayName: 'Show next version'

About

Semantic release plugin for automatic releases on Azure DevOps pipelines.

Topics

Resources

License

Packages

No packages published