You've already forked goreleaser
							
							
				mirror of
				https://github.com/goreleaser/goreleaser.git
				synced 2025-10-30 23:58:09 +02:00 
			
		
		
		
	project name, templates, readme, etc
This commit is contained in:
		
							
								
								
									
										17
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								README.md
									
									
									
									
									
								
							| @@ -75,7 +75,7 @@ PS: Invalid GOOS/GOARCH combinations will automatically be skipped. | ||||
|  | ||||
| This configuration specifies the build operating systems to Windows, Linux and MacOS using 64bit architecture, the name of the binaries is `drum-roll`. | ||||
|  | ||||
| GoReleaser will then archive the result binaries of each Os/Arch into a separate file. The default format is `{{.Binary}}_{{.Os}}_{{.Arch}}`. | ||||
| GoReleaser will then archive the result binaries of each Os/Arch into a separate file. The default format is `{{.ProjectName}}_{{.Os}}_{{.Arch}}`. | ||||
| You can change the archives name and format. You can also replace the OS and the Architecture with your own. | ||||
| Another useful feature is to add files to archives, this is very useful for integrating assets like resource files. | ||||
|  | ||||
| @@ -172,6 +172,15 @@ defaults are sensible and fit for most projects. | ||||
|  | ||||
| We'll cover all customizations available bellow: | ||||
|  | ||||
| ### Project name | ||||
|  | ||||
| ```yml | ||||
| # goreleaser.yml | ||||
| # The name of the project. It is used in the name of the brew formula, archives, | ||||
| # etc. Defaults to the name of the git project. | ||||
| project_name: myproject | ||||
| ``` | ||||
|  | ||||
| ### Build customization | ||||
|  | ||||
| ```yml | ||||
| @@ -254,14 +263,14 @@ archive: | ||||
|   # You can change the name of the archive. | ||||
|   # This is parsed with Golang template engine and the following variables | ||||
|   # are available: | ||||
|   # - Binary | ||||
|   # - ProjectName | ||||
|   # - Tag | ||||
|   # - Version (Tag with the `v` prefix stripped) | ||||
|   # - Os | ||||
|   # - Arch | ||||
|   # - Arm (ARM version) | ||||
|   # The default is `{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}` | ||||
|   name_template: "{{.Binary}}_{{.Version}}_{{.Os}}_{{.Arch}}" | ||||
|   # The default is `{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}` | ||||
|   name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" | ||||
|  | ||||
|   # Archive format. Valid options are `tar.gz` and `zip`. | ||||
|   # Default is `tar.gz` | ||||
|   | ||||
| @@ -100,7 +100,7 @@ type Snapshot struct { | ||||
|  | ||||
| // Project includes all project configuration | ||||
| type Project struct { | ||||
| 	Name     string   `yaml:",omitempty"` | ||||
| 	ProjectName string   `yaml:"project_name,omitempty"` | ||||
| 	Release     Release  `yaml:",omitempty"` | ||||
| 	Brew        Homebrew `yaml:",omitempty"` | ||||
| 	Builds      []Build  `yaml:",omitempty"` | ||||
|   | ||||
| @@ -36,7 +36,7 @@ func (c *githubClient) CreateFile( | ||||
| 		}, | ||||
| 		Content: content.Bytes(), | ||||
| 		Message: github.String( | ||||
| 			ctx.Config.Name + " version " + ctx.Git.CurrentTag, | ||||
| 			ctx.Config.ProjectName + " version " + ctx.Git.CurrentTag, | ||||
| 		), | ||||
| 	} | ||||
|  | ||||
|   | ||||
| @@ -15,7 +15,8 @@ type nameData struct { | ||||
| 	Arm         string | ||||
| 	Version     string | ||||
| 	Tag         string | ||||
| 	Binary  string | ||||
| 	Binary      string // deprecated | ||||
| 	ProjectName string | ||||
| } | ||||
|  | ||||
| // For returns the name for the given context, goos, goarch and goarm. | ||||
| @@ -26,7 +27,8 @@ func For(ctx *context.Context, goos, goarch, goarm string) (string, error) { | ||||
| 		Arm:         replace(ctx.Config.Archive.Replacements, goarm), | ||||
| 		Version:     ctx.Version, | ||||
| 		Tag:         ctx.Git.CurrentTag, | ||||
| 		Binary:  ctx.Config.Name, | ||||
| 		Binary:      ctx.Config.ProjectName, | ||||
| 		ProjectName: ctx.Config.ProjectName, | ||||
| 	} | ||||
|  | ||||
| 	var out bytes.Buffer | ||||
|   | ||||
| @@ -20,7 +20,7 @@ func TestNameFor(t *testing.T) { | ||||
| 				"amd64":  "x86_64", | ||||
| 			}, | ||||
| 		}, | ||||
| 		Name: "test", | ||||
| 		ProjectName: "test", | ||||
| 	} | ||||
| 	var ctx = &context.Context{ | ||||
| 		Config:  config, | ||||
| @@ -42,7 +42,7 @@ func TestInvalidNameTemplate(t *testing.T) { | ||||
| 			Archive: config.Archive{ | ||||
| 				NameTemplate: "{{.Binary}_{{.Os}}_{{.Arch}}_{{.Version}}", | ||||
| 			}, | ||||
| 			Name: "test", | ||||
| 			ProjectName: "test", | ||||
| 		}, | ||||
| 		Git: context.GitInfo{ | ||||
| 			CurrentTag: "v1.2.3", | ||||
| @@ -60,7 +60,7 @@ func TestNameDefaltTemplate(t *testing.T) { | ||||
| 			Archive: config.Archive{ | ||||
| 				NameTemplate: defaults.NameTemplate, | ||||
| 			}, | ||||
| 			Name: "test", | ||||
| 			ProjectName: "test", | ||||
| 		}, | ||||
| 		Version: "1.2.3", | ||||
| 	} | ||||
|   | ||||
| @@ -107,7 +107,7 @@ func doRun(ctx *context.Context, client client.Client) error { | ||||
| 		log.Warn("skipped because release is marked as draft") | ||||
| 		return nil | ||||
| 	} | ||||
| 	var path = filepath.Join(ctx.Config.Brew.Folder, ctx.Config.Name+".rb") | ||||
| 	var path = filepath.Join(ctx.Config.Brew.Folder, ctx.Config.ProjectName+".rb") | ||||
| 	log.WithField("formula", path). | ||||
| 		WithField("repo", ctx.Config.Brew.GitHub.String()). | ||||
| 		Info("pushing") | ||||
| @@ -147,7 +147,7 @@ func dataFor(ctx *context.Context, client client.Client) (result templateData, e | ||||
| 		return | ||||
| 	} | ||||
| 	return templateData{ | ||||
| 		Name:         formulaNameFor(ctx.Config.Name), | ||||
| 		Name:         formulaNameFor(ctx.Config.ProjectName), | ||||
| 		Desc:         ctx.Config.Brew.Description, | ||||
| 		Homepage:     ctx.Config.Brew.Homepage, | ||||
| 		Repo:         ctx.Config.Release.GitHub, | ||||
|   | ||||
| @@ -26,7 +26,7 @@ func (Pipe) Run(ctx *context.Context) (err error) { | ||||
| 	file, err := os.OpenFile( | ||||
| 		filepath.Join( | ||||
| 			ctx.Config.Dist, | ||||
| 			fmt.Sprintf("%v_checksums.txt", ctx.Config.Name), | ||||
| 			fmt.Sprintf("%v_checksums.txt", ctx.Config.ProjectName), | ||||
| 		), | ||||
| 		os.O_APPEND|os.O_WRONLY|os.O_CREATE|os.O_TRUNC, | ||||
| 		0644, | ||||
|   | ||||
| @@ -25,7 +25,7 @@ func TestPipe(t *testing.T) { | ||||
| 	var ctx = &context.Context{ | ||||
| 		Config: config.Project{ | ||||
| 			Dist:        folder, | ||||
| 			Name: binary, | ||||
| 			ProjectName: binary, | ||||
| 		}, | ||||
| 	} | ||||
| 	ctx.AddArtifact(file) | ||||
|   | ||||
| @@ -34,8 +34,8 @@ func (Pipe) Run(ctx *context.Context) error { | ||||
| 	if err := setReleaseDefaults(ctx); err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 	if ctx.Config.Name == "" { | ||||
| 		ctx.Config.Name = ctx.Config.Release.GitHub.Name | ||||
| 	if ctx.Config.ProjectName == "" { | ||||
| 		ctx.Config.ProjectName = ctx.Config.Release.GitHub.Name | ||||
| 	} | ||||
| 	setBuildDefaults(ctx) | ||||
| 	if ctx.Config.Brew.Install == "" { | ||||
|   | ||||
| @@ -69,7 +69,7 @@ func create(ctx *context.Context, format, folder, arch string) error { | ||||
| 	var options = []string{ | ||||
| 		"--input-type", "dir", | ||||
| 		"--output-type", format, | ||||
| 		"--name", ctx.Config.Name, | ||||
| 		"--name", ctx.Config.ProjectName, | ||||
| 		"--version", ctx.Version, | ||||
| 		"--architecture", arch, | ||||
| 		"--chdir", path, | ||||
|   | ||||
| @@ -39,7 +39,7 @@ func TestRunPipe(t *testing.T) { | ||||
| 			"darwinamd64": "anotherbin", | ||||
| 		}, | ||||
| 		Config: config.Project{ | ||||
| 			Name: "mybin", | ||||
| 			ProjectName: "mybin", | ||||
| 			Dist:        dist, | ||||
| 			FPM: config.FPM{ | ||||
| 				Formats:      []string{"deb"}, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user