Skip to content

Commit

Permalink
#13 - Allow send files after the tag/release be created.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei committed Aug 9, 2016
1 parent b643f65 commit e4262e3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,21 @@ semanticRelease {
}
```

### Enable upload release files to GitHub

The **ghToken** is mandatory.

```groovy
semanticRelease {
changeLog {
releaseAsset = { ReleaseAssets assets, String currentTag ->
assets.upload(file("build/libs/value-${currentTag}.jar").bytes, "application/zip", "run-${currentTag}.jar")
}
}
}
```


### Setup travis-ci

First, you need to [configure the environment variable GH_TOKEN in travis](http://docs.travis-ci.com/user/environment-variables/). Then you need a `.travis.yml`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,14 @@ class SemanticReleaseChangeLogService {
def type = { Commit commit ->
def pattern = /(.*?)(?:\(.+\))?:.*/
def matcher = commit.shortMessage =~ pattern
matcher ? matcher.group(1) : null
matcher ? matcher.group(1).trim() : null
}

@PackageScope
def component = { Commit commit ->
def pattern = /.*?\((.+)\):.*/
def matcher = commit.shortMessage =~ pattern
matcher ? matcher.group(1) : null
matcher ? matcher.group(1).trim() : null
}

@PackageScope
Expand Down Expand Up @@ -207,6 +207,11 @@ class SemanticReleaseChangeLogService {
repositoryUrl("compare/${previousTag}...${currentTag}")
}

@PackageScope
def releaseAsset = { ReleaseAssets assets, String currentTag ->
// waiting the custom implementation
}

@PackageScope
@Memoized
List<Commit> commits(Version previousVersion) {
Expand Down Expand Up @@ -237,6 +242,7 @@ class SemanticReleaseChangeLogService {

Release release = repo.releases().create(tag)
new Release.Smart(release).body(changeLog(commits(Version.valueOf(version.previousVersion)), version).toString())
releaseAsset(release.assets(), "$version.version")
}

private boolean tagExists(Repo repo, String tag) {
Expand Down

0 comments on commit e4262e3

Please sign in to comment.