35 lines
1.3 KiB
Groovy
35 lines
1.3 KiB
Groovy
package com.freeleaps.devops
|
|
|
|
class SemanticReleasingExecutor {
|
|
def steps
|
|
def workspace
|
|
def config
|
|
def plugins = [
|
|
'semantic-release',
|
|
'@semantic-release/git',
|
|
'@semantic-release/changelog',
|
|
'@semantic-release/exec',
|
|
'conventional-changelog-conventionalcommits'
|
|
]
|
|
|
|
SemanticReleasingExecutor(steps, workspace) {
|
|
this.steps = steps
|
|
this.workspace = workspace
|
|
// TODO: This should be a parameter, not hardcoded
|
|
this.config = 'com/freeleaps/devops/builtins/semantic-release/releaserc.json'
|
|
}
|
|
|
|
def release() {
|
|
steps.log.warn("SemanticReleasingExecutor", "Configuration file customization is not supported yet, using builtin release rules as fallback")
|
|
steps.log.info("SemanticReleasingExecutor", "Releasing with config: ${config}")
|
|
|
|
steps.dir(steps.env.workroot) {
|
|
steps.writeFile file: 'releaserc.json', text: steps.libraryResource(config)
|
|
steps.log.info("SemanticReleasingExecutor", "Installing semantic-release plugins...")
|
|
steps.sh "npm install -g ${plugins.join(' ')}"
|
|
steps.sh "semantic-release"
|
|
steps.log.info("SemanticReleasingExecutor", "Semantic release completed, read latest version from VERSION file")
|
|
steps.env.LATEST_VERSION = steps.readFile('VERSION').trim()
|
|
}
|
|
}
|
|
} |