-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwercker.yml
238 lines (190 loc) · 7 KB
/
wercker.yml
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
box:
id: eu.gcr.io/judo-ng/judo-compiler
tag: 3.6.1-jdk11
no-response-timeout: 15
command-timeout: 60
ignore-file: .gitignore
build:
steps:
- blackbelttechnology/[email protected]
- blackbelttechnology/[email protected]:
pom: osgi-encryption-parent/pom.xml
- script:
name: calculate version number
code: |-
export VERSION_NUMBER=${VERSION_FROM_POM_BASE_VERSION}.$(date +%Y%m%d_%H%M%S)_${VERSION_FROM_GIT_TAG_SHORT_SHA1}_${VERSION_FROM_GIT_TAG_CURRENT_BRANCH_VALID_NAME}
echo "Building version: ${VERSION_NUMBER}"
- wercker/maven:
goals: versions:set
pom: ./osgi-encryption-parent/pom.xml
maven_opts: -Dtycho.mode=maven -DnewVersion=${VERSION_NUMBER}
cache_repo: true
- wercker/maven:
goals: versions:set
pom: ./pom.xml
maven_opts: -Dtycho.mode=maven -DnewVersion=${VERSION_FROM_POM_BASE_VERSION}_${VERSION_FROM_GIT_TAG_CURRENT_BRANCH_VALID_NAME}-${VERSION_FROM_GIT_TAG_COMMIT_COUNT}
cache_repo: true
- wercker/maven:
goals: clean deploy
settings: .maven.xml
profiles: release-github,release-judong
cache_repo: true
- script:
name: get github release attributes
code: |-
export GITHUB_RELEASE_BODY=$(cat ./.release/.releasetemplate | jq -aRs . | sed 's/"//g')
export GITHUB_RELEASE_TITLE=$(echo "$VERSION_NUMBER" | jq -aRs . | sed 's/"//g')
echo "Release title: $GITHUB_RELEASE_TITLE"
echo "Release notes: $GITHUB_RELEASE_BODY"
- github-create-release:
token: $GITHUB_ACCESS_TOKEN
tag: $VERSION_NUMBER
title: $GITHUB_RELEASE_TITLE
body: $GITHUB_RELEASE_BODY
prerelease: true
# after-steps:
# - mbrevda/github-status:
# token: $GITHUB_ACCESS_TOKEN
# context: $WERCKER_APPLICATION_NAME
# msg: build completed
# fail: an error has occurred
# url: $WERCKER_RUN_URL
# Based on http://vincent.demeester.fr/posts/2012-07-23-maven-release-gitflow/
release:
steps:
- blackbelttechnology/[email protected]:
secretkeys: $GPG_SECRET_KEYS
ownertrust: $GPG_OWNERTRUST
# Github for SSH access
# - add-to-known_hosts:
# hostname: github.com
# fingerprint: $GITHUB_RSA_FINGERPRINT
# type: rsa
# - add-ssh-key:
# keyname: GITHUB_SSH_KEY
- script:
name: set git remote origis
code: |-
git remote set-url origin https://[email protected]/$WERCKER_GIT_OWNER/$WERCKER_GIT_REPOSITORY.git
git fetch origin
- script:
name: display branches
code: |-
git branch -a
git branch -r
- script:
name: setup git for maven
code: |-
git config --global user.email "[email protected]"
git config --global user.name "Wercker Release"
- blackbelttechnology/[email protected]
- script:
name: reset git state to actual commit
code: |-
git reset --hard $WERCKER_GIT_COMMIT
- script:
name: create barnch for builder
code: |-
git branch wercker_$WERCKER_RUN_ID
- blackbelttechnology/[email protected]:
pom: osgi-encryption-parent/pom.xml
- script:
name: create release branch from current commit
code: |-
git checkout -b release/v$VERSION_FROM_POM_BASE_VERSION wercker_$WERCKER_RUN_ID
## Deploy using release plugin
# - wercker/maven:
# goals: release:prepare
# settings: .maven.xml
# profiles: release-blackbelt
# cache_repo: true
#
# - wercker/maven:
# goals: release:perform
# settings: .maven.xml
# profiles: release-blackbelt
# cache_repo: true
# Set version and deploy with steps
- wercker/maven:
goals: versions:set
pom: ./osgi-encryption-parent/pom.xml
maven_opts: -DnewVersion=${VERSION_FROM_POM_BASE_VERSION} -DgenerateBackupPoms=false
settings: .maven.xml
cache_repo: true
- wercker/maven:
goals: versions:set
pom: ./pom.xml
maven_opts: -DnewVersion=${VERSION_FROM_POM_BASE_VERSION} -DgenerateBackupPoms=false
settings: .maven.xml
cache_repo: true
- wercker/maven:
goals: clean deploy
settings: .maven.xml
profiles: release-github,release-central
cache_repo: true
- script:
name: commit the release
code: |-
git add .
git commit -m "Release v$VERSION_FROM_POM_BASE_VERSION"
- script:
name: tag release branch
code: |-
git tag -a v$VERSION_FROM_POM_BASE_VERSION -m "Release v$VERSION_FROM_POM_BASE_VERSION"
- script:
name: increase version number (parent)
code: "mvn build-helper:parse-version versions:set -DnewVersion=\\${parsedVersion.majorVersion}.\\${parsedVersion.minorVersion}.\\${parsedVersion.nextIncrementalVersion}-SNAPSHOT -DgenerateBackupPoms=false -f ./osgi-encryption-parent/pom.xml -Dmaven.repo.local=$WERCKER_CACHE_DIR/.m2"
- script:
name: increase version number (reactor)
code: "mvn build-helper:parse-version versions:set -DnewVersion=\\${parsedVersion.majorVersion}.\\${parsedVersion.minorVersion}.\\${parsedVersion.nextIncrementalVersion}-SNAPSHOT -DgenerateBackupPoms=false -f ./pom.xml -Dmaven.repo.local=$WERCKER_CACHE_DIR/.m2"
- script:
name: commit to release branch
code: |-
git add .
git commit -m "Next development cycle"
# End of deploy
- script:
name: get back to the develop branch
code: |-
git checkout develop
- script:
name: merge the version back into develop
code: |-
git merge --no-ff release/v$VERSION_FROM_POM_BASE_VERSION
- script:
name: git checkout master
code: |-
git checkout master
- script:
name: merge the version back into master but the tagged version instead of the release/v0.1 HEAD
code: |-
git merge --no-ff release/v$VERSION_FROM_POM_BASE_VERSION~1
- script:
name: draw git
code: |-
git log --graph --oneline --all
- script:
name: delete release branch
code: |-
git branch -D release/v$VERSION_FROM_POM_BASE_VERSION
- script:
name: delete builder branch
code: |-
git branch -D wercker_$WERCKER_RUN_ID
- script:
name: push everything
code: |-
git push origin --all
git push origin --tags
- script:
name: get github release attributes
code: |-
export GITHUB_RELEASE_BODY=$(cat ./.release/.releasetemplate | jq -aRs . | sed 's/"//g')
export GITHUB_RELEASE_TITLE=$(echo "$VERSION_NUMBER" | jq -aRs . | sed 's/"//g')
echo "Release title: $GITHUB_RELEASE_TITLE"
echo "Release notes: $GITHUB_RELEASE_BODY"
- github-create-release:
token: $GITHUB_ACCESS_TOKEN
tag: $VERSION_NUMBER
title: $GITHUB_RELEASE_TITLE
body: $GITHUB_RELEASE_BODY