-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.Jenkinsfile
78 lines (77 loc) · 2.42 KB
/
release.Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
pipeline {
options {
buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10'))
disableConcurrentBuilds()
timeout(time: 60, unit: 'MINUTES')
timestamps()
}
agent {
label 'caila-dev-cloud-agent'
}
parameters {
string(name: "RELEASE_BRANCH", defaultValue: "release", description: "")
string(name: "NEW_VERSION", defaultValue: "1.0.0", description: '')
}
environment {
GITLAB_REPO = 'git@gitlab.just-ai.com:mpl-public/mpl-python-sdk.git'
GITHUB_REPO = 'git@github.com:just-ai/mlp-python-sdk.git'
}
stages {
stage('Prepare') {
steps {
script {
manager.addShortText("${params.RELEASE_BRANCH}")
manager.addShortText("${params.NEW_VERSION}")
}
git url: env.GITLAB_REPO,
branch: "${params.RELEASE_BRANCH}",
credentialsId: 'bitbucket_key'
}
}
stage('Set Version') {
steps {
script {
sh """
sed -i "s/version=.*/version=\"${params.NEW_VERSION}\",/" setup.py
"""
}
}
}
stage('Build and deploy') {
steps {
script {
sh "./build_wheel.sh"
sh "twine upload --repository nexus mlp_sdk-${params.NEW_VERSION}-py3-none-any.whl"
}
}
}
stage('Commit and Tag') {
steps {
script {
sh """
git add setup.py
git commit -m "update release version to ${params.NEW_VERSION}"
git tag -a v${params.NEW_VERSION} -m 'Release version ${params.NEW_VERSION}'
"""
}
}
}
stage('Push Changes') {
steps {
script {
sh """
git push ${env.GITLAB_REPO} ${params.RELEASE_BRANCH}
git push ${env.GITLAB_REPO} --tags
git push ${env.GITHUB_REPO} ${params.RELEASE_BRANCH}
git push ${env.GITHUB_REPO} --tags
"""
}
}
}
}
post {
always {
cleanWs()
}
}
}