forked from BreweryTeam/TheBrewingProject
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
30 lines (26 loc) · 1.11 KB
/
Jenkinsfile
File metadata and controls
30 lines (26 loc) · 1.11 KB
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
pipeline {
agent none
stages {
stage('Build') {
agent { label 'linux-jdk21' }
steps {
sh 'chmod +x gradlew'
sh './gradlew bukkit:shadowJar migration:shadowJar'
script {
def sanitizedBranch = env.BRANCH_NAME.replaceAll(/[^a-zA-Z0-9._]/, '_')
def shortHash = env.GIT_COMMIT.substring(0, 6)
def jars = findFiles(glob: 'bukkit/build/libs/TheBrewingProject*.jar') + findFiles(glob: 'migration/build/libs/TheBrewingProjectMigration*.jar')
jars.each { jar ->
def newPath = jar.path.replaceFirst(/\.jar$/, "-${sanitizedBranch}-${shortHash}.jar")
sh "mv '${jar.path}' '${newPath}'"
}
}
}
post {
always {
archiveArtifacts artifacts: 'bukkit/build/libs/TheBrewingProject*.jar, migration/build/libs/TheBrewingProjectMigration*.jar', fingerprint: true
}
}
}
}
}