1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-05-31 23:19:45 +02:00

Merge branch 'master' into lint

This commit is contained in:
Carlos Alexandro Becker 2017-10-01 09:46:14 -03:00 committed by GitHub
commit e798a8dc3a
7 changed files with 43 additions and 13 deletions

View File

@ -36,21 +36,28 @@ func (r Repo) String() string {
// Homebrew contains the brew section // Homebrew contains the brew section
type Homebrew struct { type Homebrew struct {
GitHub Repo `yaml:",omitempty"` GitHub Repo `yaml:",omitempty"`
Folder string `yaml:",omitempty"` CommitAuthor CommitAuthor `yaml:"commit_author,omitempty"`
Caveats string `yaml:",omitempty"` Folder string `yaml:",omitempty"`
Plist string `yaml:",omitempty"` Caveats string `yaml:",omitempty"`
Install string `yaml:",omitempty"` Plist string `yaml:",omitempty"`
Dependencies []string `yaml:",omitempty"` Install string `yaml:",omitempty"`
Test string `yaml:",omitempty"` Dependencies []string `yaml:",omitempty"`
Conflicts []string `yaml:",omitempty"` Test string `yaml:",omitempty"`
Description string `yaml:",omitempty"` Conflicts []string `yaml:",omitempty"`
Homepage string `yaml:",omitempty"` Description string `yaml:",omitempty"`
Homepage string `yaml:",omitempty"`
// Capture all undefined fields and should be empty after loading // Capture all undefined fields and should be empty after loading
XXX map[string]interface{} `yaml:",inline"` XXX map[string]interface{} `yaml:",inline"`
} }
// CommitAuthor is the author of a Git commit
type CommitAuthor struct {
Name string `yaml:",omitempty"`
Email string `yaml:",omitempty"`
}
// Hooks define actions to run before and/or after something // Hooks define actions to run before and/or after something
type Hooks struct { type Hooks struct {
Pre string `yaml:",omitempty"` Pre string `yaml:",omitempty"`

View File

@ -90,7 +90,7 @@ $ git tag -a v0.1.0 -m "First release"
$ git push origin v0.1.0 $ git push origin v0.1.0
``` ```
**Note**: @e recommend the use of [semantic versioning](http://semver.org/). We **Note**: We recommend the use of [semantic versioning](http://semver.org/). We
are not enforcing it though. We do remove the `v` prefix and then enforce are not enforcing it though. We do remove the `v` prefix and then enforce
that the next character is a number. So, `v0.1.0` and `0.1.0` are virtually the that the next character is a number. So, `v0.1.0` and `0.1.0` are virtually the
same and are both accepted, while `version0.1.0` is not. same and are both accepted, while `version0.1.0` is not.

View File

@ -28,3 +28,10 @@ You can have a markdown file previously created with the release notes, and
pass it down to goreleaser with the `--release-notes=FILE` flag. pass it down to goreleaser with the `--release-notes=FILE` flag.
GoReleaser will then skip its own release notes generation, GoReleaser will then skip its own release notes generation,
using the contents of your file instead. using the contents of your file instead.
On Unix systems you can also generate the release notes in-line by using [process substitution](https://en.wikipedia.org/wiki/Process_substitution).
To list all commits since the last tag, but skip ones starting with `Merge` or `docs`, you could run this command:
```sh
goreleaser --release-notes <(git log --pretty=oneline --abbrev-commit $(git describe --tags --abbrev=0)^.. | grep -v '^[^ ]* \(Merge\|docs\)')
```

View File

@ -20,6 +20,11 @@ brew:
owner: user owner: user
name: homebrew-tap name: homebrew-tap
# Git author used to commit to the repository.
commit_author:
name: goreleaserbot
email: goreleaser@carlosbecker.com
# Folder inside the repository to put the formula. # Folder inside the repository to put the formula.
# Default is the root folder. # Default is the root folder.
folder: Formula folder: Formula

View File

@ -44,8 +44,8 @@ func (c *githubClient) CreateFile(
) (err error) { ) (err error) {
options := &github.RepositoryContentFileOptions{ options := &github.RepositoryContentFileOptions{
Committer: &github.CommitAuthor{ Committer: &github.CommitAuthor{
Name: github.String("goreleaserbot"), Name: github.String(ctx.Config.Brew.CommitAuthor.Name),
Email: github.String("goreleaser@carlosbecker.com"), Email: github.String(ctx.Config.Brew.CommitAuthor.Email),
}, },
Content: content.Bytes(), Content: content.Bytes(),
Message: github.String( Message: github.String(

View File

@ -43,7 +43,9 @@ func (Pipe) Run(ctx *context.Context) error {
if ctx.Config.ProjectName == "" { if ctx.Config.ProjectName == "" {
ctx.Config.ProjectName = ctx.Config.Release.GitHub.Name ctx.Config.ProjectName = ctx.Config.Release.GitHub.Name
} }
setBuildDefaults(ctx) setBuildDefaults(ctx)
if ctx.Config.Brew.Install == "" { if ctx.Config.Brew.Install == "" {
var installs []string var installs []string
for _, build := range ctx.Config.Builds { for _, build := range ctx.Config.Builds {
@ -58,6 +60,13 @@ func (Pipe) Run(ctx *context.Context) error {
ctx.Config.Brew.Install = strings.Join(installs, "\n") ctx.Config.Brew.Install = strings.Join(installs, "\n")
} }
if ctx.Config.Brew.CommitAuthor.Name == "" {
ctx.Config.Brew.CommitAuthor.Name = "goreleaserbot"
}
if ctx.Config.Brew.CommitAuthor.Email == "" {
ctx.Config.Brew.CommitAuthor.Email = "goreleaser@carlosbecker.com"
}
err := setArchiveDefaults(ctx) err := setArchiveDefaults(ctx)
setDockerDefaults(ctx) setDockerDefaults(ctx)
log.WithField("config", ctx.Config).Debug("defaults set") log.WithField("config", ctx.Config).Debug("defaults set")

View File

@ -32,6 +32,8 @@ func TestFillBasicData(t *testing.T) {
assert.Equal(t, "tar.gz", ctx.Config.Archive.Format) assert.Equal(t, "tar.gz", ctx.Config.Archive.Format)
assert.Contains(t, ctx.Config.Brew.Install, "bin.install \"goreleaser\"") assert.Contains(t, ctx.Config.Brew.Install, "bin.install \"goreleaser\"")
assert.Empty(t, ctx.Config.Dockers) assert.Empty(t, ctx.Config.Dockers)
assert.Equal(t, ctx.Config.Brew.CommitAuthor.Name, "goreleaserbot")
assert.Equal(t, ctx.Config.Brew.CommitAuthor.Email, "goreleaser@carlosbecker.com")
assert.NotEmpty( assert.NotEmpty(
t, t,
ctx.Config.Archive.NameTemplate, ctx.Config.Archive.NameTemplate,