-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrelease_groovy_plugin_maven.gocd.groovy
75 lines (73 loc) · 2.57 KB
/
release_groovy_plugin_maven.gocd.groovy
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
def secretParam = { String param ->
return "{{SECRET:[build-pipelines][$param]}}".toString()
}
String org = "gocd-contrib"
String repo = "gocd-groovy-dsl-config-plugin"
GoCD.script {
pipelines {
pipeline('upload-groovy-plugin-to-maven') {
group = 'plugins'
labelTemplate = '${COUNT}'
lockBehavior = 'none'
materials {
git('signing-keys') {
url = "https://git.gocd.io/git/gocd/signing-keys"
destination = "signing-keys"
}
git('groovy') {
url = "https://git.gocd.io/git/${org}/${repo}"
shallowClone = false
destination = 'groovy'
}
dependency('GroovyPipeline') {
pipeline = "${org}-${repo}"
stage = 'github-release'
}
}
stages {
stage('upload') {
artifactCleanupProhibited = false
cleanWorkingDir = true
fetchMaterials = true
environmentVariables = [
'GNUPGHOME' : '.signing',
'GOCD_GPG_KEYRING_FILE' : 'signing-key.gpg',
'GOCD_GPG_PASSPHRASE' : secretParam("GOCD_GPG_PASSPHRASE"),
'MAVEN_CENTRAL_TOKEN_USERNAME' : secretParam("MAVEN_CENTRAL_TOKEN_USERNAME"),
'MAVEN_CENTRAL_TOKEN_PASSWORD' : secretParam("MAVEN_CENTRAL_TOKEN_PASSWORD"),
]
secureEnvironmentVariables = [
GOCD_GPG_KEY_ID: 'AES:+ORNmqROtoiLtfp+q4FlfQ==:PxQcI6mOtG4J/WQHS9jakg=='
]
jobs {
job('upload-to-maven') {
elasticProfileId = 'ecs-gocd-dev-build'
tasks {
bash {
commandString = 'mkdir -p ${GNUPGHOME}'
workingDir = "groovy"
}
bash {
commandString = 'echo ${GOCD_GPG_PASSPHRASE} > gpg-passphrase'
workingDir = "groovy"
}
bash {
commandString = 'gpg --quiet --batch --passphrase-file gpg-passphrase --output - ../signing-keys/gpg-keys.pem.gpg | gpg --import --batch --quiet'
workingDir = "groovy"
}
bash {
commandString = 'gpg --export-secret-keys ${GOCD_GPG_KEY_ID} > dsl/${GOCD_GPG_KEYRING_FILE}'
workingDir = "groovy"
}
bash {
commandString = './gradlew clean dsl:publishToSonatype closeAndReleaseSonatypeStagingRepository'
workingDir = "groovy"
}
}
}
}
}
}
}
}
}