-
Notifications
You must be signed in to change notification settings - Fork 6
/
Jenkinsfile
46 lines (45 loc) · 1.18 KB
/
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
pipeline {
agent {
docker {
reuseNode 'true'
registryUrl 'https://coding-public-docker.pkg.coding.net'
image 'public/docker/php:8.0'
}
}
stages {
stage('检出') {
steps {
checkout([
$class: 'GitSCM',
branches: [[name: GIT_BUILD_REF]],
userRemoteConfigs: [[
url: GIT_REPO_URL,
credentialsId: CREDENTIALS_ID
]]])
}
}
stage('打包') {
steps {
script {
if (env.TAG_NAME ==~ /.*/ ) {
BUILD_VERSION = "${env.TAG_NAME}"
} else if (env.MR_SOURCE_BRANCH ==~ /.*/ ) {
BUILD_VERSION = "dev-${env.MR_RESOURCE_ID}-${env.GIT_COMMIT_SHORT}"
} else {
BUILD_VERSION = "dev-${env.BRANCH_NAME.replace('/', '-')}-${env.GIT_COMMIT_SHORT}"
}
}
sh 'composer install'
sh "php coding app:build --build-version=${BUILD_VERSION}"
}
}
stage('上传到制品库') {
steps {
sh 'mv builds/coding builds/coding.phar'
dir ('builds') {
codingArtifactsGeneric(files: 'coding.phar', repoName: 'downloads', version: "${BUILD_VERSION}")
}
}
}
}
}