Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The github-travis-releaser takes enviroment variables from travis and parses the
| Name | Description |
|------|-------------|
| -draft | Set the release as a draft |
| -prerelease | Set if the the release is identified as non-production ready |
| -verbose | Print logging statements |

### Example `.travis.yml`
Expand Down
1 change: 1 addition & 0 deletions assets/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The github-travis-releaser takes enviroment variables from travis and parses the
| Name | Description |
|------|-------------|
| -draft | Set the release as a draft |
| -prerelease | Set if the the release is identified as non-production ready |
| -verbose | Print logging statements |

### Example `.travis.yml`
Expand Down
18 changes: 10 additions & 8 deletions cmd/github-release-cli/travis.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var buildTag = ""
func main() {

draft := flag.Bool("draft", false, "set if the the release should be added as a draft")
prerelease := flag.Bool("prerelease", false, "set if the the release is identified as non-production ready")
verbose := flag.Bool("verbose", false, "print logging statements")
version := flag.Bool("version", false, "print the current version of the releaser")
flag.Parse()
Expand Down Expand Up @@ -68,14 +69,15 @@ func main() {
}

config := releaser.ReleaseConfig{
FileGlob: os.Getenv("FILES"),
Owner: repoSlug.Owner,
Repo: repoSlug.Repo,
TagName: tag,
Name: name,
Body: os.Getenv("BODY"),
Draft: *draft,
Logger: logger,
FileGlob: os.Getenv("FILES"),
Owner: repoSlug.Owner,
Repo: repoSlug.Repo,
TagName: tag,
Name: name,
Body: os.Getenv("BODY"),
Draft: *draft,
Prerelease: *prerelease,
Logger: logger,
}

err = releaser.Release(
Expand Down
28 changes: 16 additions & 12 deletions pkg/releaser/releaser.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ import (

// The ReleaseConfig is the configuration of a release and its uploads
type ReleaseConfig struct {
FileGlob string
Owner string
Repo string
TagName string
Name string
Body string
Draft bool
FileGlob string
Owner string
Repo string
TagName string
Name string
Body string
Draft bool
Prerelease bool

Logger Logger
}
Expand All @@ -29,14 +30,16 @@ Repo: %s
TagName: %s
Name: %v
Body: %s
Draft: %v`,
Draft: %v
Prerelease: %v`,
c.FileGlob,
c.Owner,
c.Repo,
c.TagName,
c.Name,
c.Body,
c.Draft,
c.Prerelease,
)
}

Expand Down Expand Up @@ -84,10 +87,11 @@ func Release(

config.printf("creating a release")
release, _, err := client.Repositories.CreateRelease(ctx, config.Owner, config.Repo, &github.RepositoryRelease{
TagName: &config.TagName,
Name: &config.Name,
Draft: &config.Draft,
Body: &config.Body,
TagName: &config.TagName,
Name: &config.Name,
Draft: &config.Draft,
Body: &config.Body,
Prerelease: &config.Prerelease,
})
if err != nil {
return err
Expand Down