semantic-release
AboutGitHubNeed Help?
master
master
  • README
  • Usage
    • Getting started
    • Installation
    • CI Configuration
    • Configuration
    • Plugins
    • Release Workflow configuration
    • Shareable configurations
  • Extending
    • Plugins
    • Shareable configuration
  • Recipes
    • CI configurations
      • CircleCI 2.0
      • Travis CI
      • GitLab CI
      • GitHub Actions
      • Jenkins CI
    • Git hosted services
      • Git authentication with SSH keys
    • Release Workflow
      • Publishing on distribution channels
      • Publishing maintenance releases
      • Publishing pre-releases
  • Developer guide
    • JavaScript API
    • Plugin development
    • Shareable configuration development
  • Support
    • Resources
    • Frequently Asked Questions
    • Troubleshooting
    • Node version requirement
    • Node Support Policy
    • Git version requirement
Powered by GitBook
On this page
  • Environment variables
  • Node.js project configuration
  • Jenkinsfile (Declarative Pipeline) configuration for a Node.js job
  • package.json configuration for a Node job
Edit on GitHub
  1. Recipes
  2. CI configurations

Jenkins CI

PreviousGitHub ActionsNextGit hosted services

Last updated 3 years ago

Environment variables

The environment variables can be configured in ..

Alternatively, the default NPM_TOKEN and GH_TOKEN can be easily .

Node.js project configuration

Jenkinsfile (Declarative Pipeline) configuration for a Node.js job

Note: The publish pipeline must run a Node version that .

This example is a minimal configuration for semantic-release with a build running a version of Node labelled as "node LTS". Since versions of Node are manually downloaded and labelled, we recommend keeping the version used for the release steps up-to-date with the latest LTS version. See the for additional configuration options.

// The release stage in the pipeline will run only if the test stage in the pipeline is successful
pipeline {
    agent any
    environment {
        GH_TOKEN  = credentials('some-id')
    }
    stages {
        stage('Test') {
            steps {
                sh '''
                # Configure your test steps here (checkout, npm install, tests etc)
                npm install
                npm test
                '''
            }
        }
        stage('Release') {
            tools {
                nodejs "node LTS"
            }
            steps {
                sh '''
                # Run optional required steps before releasing
                npx semantic-release
                '''
            }
        }
    }
}

package.json configuration for a Node job

{
  "devDependencies": {
    "semantic-release": "^18.0.0"
  }
}

A package.json is required only for semantic-release installation.

Jenkins Project Settings
meets our requirement
Jenkins documentation
setup with semantic-release-cli
Authentication
local