Skip to content

Commit

Permalink
automate releases and release 0.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tomzo committed Feb 12, 2019
1 parent a77dce3 commit 89f2cc0
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 6 deletions.
23 changes: 23 additions & 0 deletions .build/releaser
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,29 @@ function set_version_in_changelog {
fi
}

# Given the old_version in a SemVer format, e.g. 0.1.2, returns new version
# with patch fragment increased by 1, e.g. 0.1.3.
# Arguments:
# old_version
function bump_patch_version {
local old_version="${1?old_version not set}"
log_debug "Validating old_version"
validate_version_is_semver "${old_version}"
exit_status="$?"
if [[ "${exit_status}" != 0 ]]; then
return "${exit_status}"
fi

#replace . with space so can split into an array
version_bits=(${old_version//./\ })
major=${version_bits[0]}
minor=${version_bits[1]}
patch=${version_bits[2]}

patch=$((patch+1))
echo "${major}.${minor}.${patch}"
}

# You should invoke that function before running any end user functions.
function releaser_init {
default_changelog_file="$(pwd)/CHANGELOG.md"
Expand Down
12 changes: 12 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

If you are submitting a new feature then please do a **minor version bump** by
```
./tasks.sh set_version 0.X.0
```

If you are submitting a fix, then do not change any versions as patch bump is made right after each release.

PR should contain:
- tests of new/changed behavior
- documentation if adding new feature
- added change summary in CHANGELOG.md
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### 0.9.0 (2019-Feb-12)

* automate releases and version bump
* support nested lists of stages \#95
* added syntax to configure new scms \#109

# 0.8.6 (21 Jan 2019)

* Changed JSON keys returned by `get-capabilities` call
Expand Down
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ sudo bash -c "`curl -L https://raw.githubusercontent.com/ai-traders/ide/master/i

Add `Idefile` in your project with following content
```
IDE_DOCKER_IMAGE=tomzo/gocd-yaml-ide:0.8.6
IDE_DOCKER_IMAGE=tomzo/gocd-yaml-ide:<plugin-version>
```

To validate files run:
Expand All @@ -211,7 +211,7 @@ watch gocd-yaml syntax ci.gocd.yaml
## Usage with docker only

```
docker run -ti --rm --volume $(pwd):/ide/work tomzo/gocd-yaml-ide:0.8.6 bash
docker run -ti --rm --volume $(pwd):/ide/work tomzo/gocd-yaml-ide:<plugin-version> bash
```
Then you have an interactive shell as above.

Expand Down Expand Up @@ -1075,9 +1075,20 @@ pipelines:

Run all tests and create a ready to use jar
```bash
./gradlew test fatJar
./gradlew test jar
```

## Versioning

We use semantic versioning.

If you are submitting a new feature then please run a major version bump by
```
./tasks.sh set_version 0.X.0
```
If you are submitting a fix, then do not change any versions as patch bump is made right after each release.
## Tests structure
There are [examples of yaml partials](src/test/resources/parts) and
Expand Down
5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ plugins {
}

group 'cd.go.plugin.config.yaml'
version '0.8.6'
version "0.9.0"

apply plugin: 'java'
apply plugin: "com.github.jk1.dependency-license-report"

project.ext.pluginDesc = [
version : project.version,
version: project.version,
goCdVersion: '18.12.0'
]

Expand Down Expand Up @@ -108,4 +108,3 @@ jar {
licenseReport {
renderers = [new NoticeFileGenerator(new TeeRenderer(new SimpleHtmlReportRenderer()), "${project.buildDir}/reports/dependency-license/")]
}

17 changes: 17 additions & 0 deletions ci.gocd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,20 @@ pipelines:
arguments:
- -c
- ./tasks.sh publish_docker_public
- bump:
clean_workspace: true
jobs:
patch:
elastic_profile_id: w.c2.m2048.e10
tasks:
- exec:
command: /bin/bash
arguments:
- ./tasks.sh
- set_version
- exec:
command: git
arguments:
- push
- origin
- master
10 changes: 10 additions & 0 deletions tasks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ function get_version_tag {

command="$1"
case "${command}" in
set_version)
if [[ -n "$2" ]]; then
next_version="$2"
else
changelog_version=$(get_last_version_from_changelog "${changelog_file}")
next_version=$(bump_patch_version $changelog_version)
fi
set_version_in_changelog "${changelog_file}" "${next_version}"
set_version_in_file "version " "build.gradle" "${next_version}"
;;
build_docker)
changelog_version=$(get_last_version_from_changelog "${changelog_file}")
docker_build_options="--build-arg this_image_tag_arg=${changelog_version}"
Expand Down

0 comments on commit 89f2cc0

Please sign in to comment.