Skip to content

Commit da7c9aa

Browse files
committed
automate releases and release 0.3.7
1 parent 4af4b79 commit da7c9aa

File tree

7 files changed

+99
-9
lines changed

7 files changed

+99
-9
lines changed

.build/releaser

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,11 @@ function set_version_in_file {
142142
# Arguments:
143143
# new_version
144144
# changelog_file
145+
# unreleased?
145146
function set_version_in_changelog {
146147
changelog_file="$1"
147148
new_version="$2"
149+
unreleased="$3"
148150

149151
if [[ -z "${new_version}" ]];then
150152
log_error "new_version not set"
@@ -175,8 +177,12 @@ function set_version_in_changelog {
175177
return 0
176178
else
177179
log_debug "Will add new line to changelog:"
178-
release_date=$(LANG=en_US date +%Y-%b-%d)
179-
new_line="### ${new_version} (${release_date})"
180+
if [[ "$unreleased" == "true" ]]; then
181+
new_line="### ${new_version} - Unreleased"
182+
else
183+
release_date=$(LANG=en_US date +%Y-%b-%d)
184+
new_line="### ${new_version} (${release_date})"
185+
fi
180186
log_debug "${new_line}"
181187
if [[ "${dryrun}" != "true" ]];then
182188
old_changelog=$(cat "${changelog_file}")
@@ -190,6 +196,29 @@ function set_version_in_changelog {
190196
fi
191197
}
192198

199+
# Given the old_version in a SemVer format, e.g. 0.1.2, returns new version
200+
# with patch fragment increased by 1, e.g. 0.1.3.
201+
# Arguments:
202+
# old_version
203+
function bump_patch_version {
204+
local old_version="${1?old_version not set}"
205+
log_debug "Validating old_version"
206+
validate_version_is_semver "${old_version}"
207+
exit_status="$?"
208+
if [[ "${exit_status}" != 0 ]]; then
209+
return "${exit_status}"
210+
fi
211+
212+
#replace . with space so can split into an array
213+
version_bits=(${old_version//./\ })
214+
major=${version_bits[0]}
215+
minor=${version_bits[1]}
216+
patch=${version_bits[2]}
217+
218+
patch=$((patch+1))
219+
echo "${major}.${minor}.${patch}"
220+
}
221+
193222
# You should invoke that function before running any end user functions.
194223
function releaser_init {
195224
default_changelog_file="$(pwd)/CHANGELOG.md"

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
If you are submitting a new feature then please do a **minor version bump** by
3+
```
4+
./tasks.sh set_version 0.X.0
5+
```
6+
7+
If you are submitting a fix, then do not change any versions as patch bump is made right after each release.
8+
9+
PR should contain:
10+
- tests of new/changed behavior
11+
- documentation if adding new feature
12+
- added change summary in CHANGELOG.md

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
### 0.3.7 (2019-Feb-12)
2+
3+
* fix repo-level configuration not being applied \#40
4+
* Generate reproducible binaries \#38
5+
16
# 0.3.6 (21 Jan 2019)
27

38
* Changed JSON keys returned by `get-capabilities` call

README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ sudo bash -c "`curl -L https://raw.githubusercontent.com/ai-traders/ide/master/i
123123

124124
Add `Idefile` in your project with following content
125125
```
126-
IDE_DOCKER_IMAGE=tomzo/gocd-json-ide:0.3.6
126+
IDE_DOCKER_IMAGE=tomzo/gocd-json-ide:<plugin-version>
127127
```
128128

129129
To validate files run:
@@ -146,7 +146,7 @@ watch gocd-json syntax mypipe.gopipeline.json
146146
## Usage with docker only
147147

148148
```
149-
docker run -ti --rm --volume $(pwd):/ide/work tomzo/gocd-json-ide:0.3.6 bash
149+
docker run -ti --rm --volume $(pwd):/ide/work tomzo/gocd-json-ide:<plugin-version> bash
150150
```
151151
Then you have an interactive shell as above.
152152

@@ -695,7 +695,7 @@ which usually makes more sense considering that value is stored in SCM.
695695
}
696696
```
697697

698-
Since GoCD `>= 19.2.0` defining new pluggable materials that are not defined
698+
Since GoCD `>= 19.2.0` defining new pluggable materials that are not defined
699699
in the GoCD server is supported.
700700

701701
```json
@@ -911,7 +911,19 @@ Create issues and PRs if
911911

912912
There has been a long effort to make it possible to store configuration in SCMs,
913913
so obviously there will be some errors in lots of new code. Please file issues
914-
here or ask on [gocd gitter chat](https://gitter.im/gocd/gocd).
914+
here or ask on [gitter chat for config-repo plugins](https://gitter.im/gocd/configrepo-plugins).
915+
916+
917+
## Versioning
918+
919+
We use semantic versioning.
920+
921+
If you are submitting a new feature then please run a major version bump by
922+
```
923+
./tasks.sh set_version 0.X.0
924+
```
925+
926+
If you are submitting a fix, then do not change any versions as patch bump is made right after each release.
915927

916928
# License and Authors
917929

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ plugins {
66
id "com.github.jk1.dependency-license-report"
77
}
88

9-
group = 'com.thoughtworks.go'
10-
version = '0.3.6'
9+
group = 'cd.go.plugin.config.json'
10+
version "0.3.7"
1111

1212
apply plugin: 'java'
1313

1414
project.ext.pluginDesc = [
15-
version : project.version,
15+
version: project.version,
1616
goCdVersion: '18.12.0'
1717
]
1818

ci.gocd.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,20 @@ pipelines:
7979
arguments:
8080
- -c
8181
- ./tasks.sh publish_docker_public
82+
- bump:
83+
clean_workspace: true
84+
jobs:
85+
patch:
86+
elastic_profile_id: w.c2.m2048.e10
87+
tasks:
88+
- exec:
89+
command: /bin/bash
90+
arguments:
91+
- ./tasks.sh
92+
- set_version
93+
- exec:
94+
command: git
95+
arguments:
96+
- push
97+
- origin
98+
- master

tasks.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,21 @@ function get_version_tag {
2727

2828
command="$1"
2929
case "${command}" in
30+
set_version)
31+
if [[ -n "$2" ]]; then
32+
next_version="$2"
33+
else
34+
changelog_version=$(get_last_version_from_changelog "${changelog_file}")
35+
next_version=$(bump_patch_version $changelog_version)
36+
fi
37+
set_version_in_changelog "${changelog_file}" "${next_version}" "true"
38+
set_version_in_file "version " "build.gradle" "${next_version}"
39+
;;
40+
prepare_release)
41+
next_version=$(get_last_version_from_changelog "${changelog_file}")
42+
set_version_in_changelog "${changelog_file}" "${next_version}" "false"
43+
set_version_in_file "version " "build.gradle" "${next_version}"
44+
;;
3045
build_docker)
3146
changelog_version=$(get_last_version_from_changelog "${changelog_file}")
3247
docker_build_options="--build-arg this_image_tag_arg=${changelog_version}"

0 commit comments

Comments
 (0)