mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-04 03:11:55 +02:00
Update readme with optionals
This commit is contained in:
parent
5ebe98b9d7
commit
432f12967b
63
README.md
63
README.md
@ -2,8 +2,8 @@
|
||||
|
||||
<img src="https://avatars2.githubusercontent.com/u/24697112?v=3&s=200" alt="goreleaser" align="right" />
|
||||
|
||||
GoReleaser builds Go binaries for several platforms, creates a github release and then
|
||||
push a homebrew formulae to a repository. All that wrapped in your favorite CI.
|
||||
GoReleaser builds Go binaries for several platforms, creates a Github release and then
|
||||
push a Homebrew formulae to a repository. All that wrapped in your favorite CI.
|
||||
|
||||
This project adheres to the Contributor Covenant [code of conduct](CODE_OF_CONDUCT.md).
|
||||
By participating, you are expected to uphold this code. Please report unacceptable behavior to root@carlosbecker.com.
|
||||
@ -14,45 +14,40 @@ By participating, you are expected to uphold this code. Please report unacceptab
|
||||
|
||||
The idea started with a [simple shell script](https://github.com/goreleaser/old-go-releaser),
|
||||
but it quickly became more complex and I also wanted to publish binaries via
|
||||
homebrew.
|
||||
Homebrew.
|
||||
|
||||
So, the all-new goreleaser was born.
|
||||
|
||||
## Usage
|
||||
|
||||
Create a `goreleaser.yml` file in the root of your repository. A minimal config
|
||||
would look like this:
|
||||
|
||||
```yaml
|
||||
repo: user/repo
|
||||
binary_name: my-binary
|
||||
```
|
||||
|
||||
You may then run releaser at the root of your repository:
|
||||
|
||||
```sh
|
||||
curl -s https://raw.githubusercontent.com/goreleaser/get/master/latest | bash
|
||||
```
|
||||
|
||||
For that to work, you need to export a `GITHUB_TOKEN` environment variable with
|
||||
You need to export a `GITHUB_TOKEN` environment variable with
|
||||
the `repo` scope selected. You can create one
|
||||
[here](https://github.com/settings/tokens/new).
|
||||
|
||||
GoReleaser uses the latest [Git tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging) of your repository,
|
||||
so you need to [create a tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging#Annotated-Tags) first.
|
||||
|
||||
This will build `main.go` as `my-binary`, for `Darwin` and `Linux`
|
||||
Now you can run `releaser` at the root of your repository:
|
||||
|
||||
```sh
|
||||
curl -s https://raw.githubusercontent.com/goreleaser/get/master/latest | bash
|
||||
```
|
||||
|
||||
This will build `main.go` as binary, for `Darwin` and `Linux`
|
||||
(`amd64` and `i386`), archive the binary and common files as `.tar.gz`,
|
||||
and finally, publish a new github release in the `user/repo` repository with
|
||||
and finally, publish a new Github release in the repository with
|
||||
archives uploaded.
|
||||
|
||||
|
||||
For further customization create a `goreleaser.yml` file in the root of your repository.
|
||||
|
||||
### Homebrew
|
||||
|
||||
Add a `brew` section to push a formulae to a Homebrew tab repository:
|
||||
|
||||
```yaml
|
||||
repo: user/repo
|
||||
binary_name: my-binary
|
||||
brew:
|
||||
repo: user/homebrew-tap
|
||||
folder: optional/subfolder/inside/the/repo
|
||||
@ -66,8 +61,6 @@ See the [Homebrew docs](https://github.com/Homebrew/brew/blob/master/docs/How-to
|
||||
Just add a `build` section
|
||||
|
||||
```yaml
|
||||
repo: user/repo
|
||||
binary_name: my-binary
|
||||
build:
|
||||
main: ./cmd/main.go
|
||||
ldflags: -s -w
|
||||
@ -87,8 +80,6 @@ You can customize the name and format of the archive adding an `archive`
|
||||
section:
|
||||
|
||||
```yaml
|
||||
repo: user/repo
|
||||
binary_name: my-binary
|
||||
archive:
|
||||
name_template: "{{.BinaryName}}_{{.Version}}_{{.Os}}_{{.Arch}}"
|
||||
format: zip
|
||||
@ -111,8 +102,6 @@ You might also want to change the files that are packaged by adding a `files`
|
||||
section:
|
||||
|
||||
```yaml
|
||||
repo: user/repo
|
||||
binary_name: my-binary
|
||||
files:
|
||||
- LICENSE.txt
|
||||
- README.md
|
||||
@ -139,6 +128,24 @@ func main() {
|
||||
|
||||
And this version will always be the tag name.
|
||||
|
||||
|
||||
### Other customizations
|
||||
|
||||
- By default it's assumed that the repository to release to is the same as the Git `remote origin`.
|
||||
If this is not the case for your project, you can specify a `repo`:
|
||||
|
||||
```yaml
|
||||
repo: owner/custom-repo
|
||||
```
|
||||
|
||||
- By default the binary name is the name of the project directory.
|
||||
You can specify a different `binary_name`:
|
||||
|
||||
```yaml
|
||||
binary_name: my-binary
|
||||
```
|
||||
|
||||
|
||||
## Wire it with travis-ci
|
||||
|
||||
You may want to wire this to auto-deploy your new tags on travis, for example:
|
||||
@ -150,12 +157,12 @@ after_success:
|
||||
|
||||
## What the end result looks like
|
||||
|
||||
The release on github looks pretty much like this:
|
||||
The release on Github looks pretty much like this:
|
||||
|
||||
[![image](https://cloud.githubusercontent.com/assets/245435/21578845/09404c8a-cf78-11e6-92d7-165ddc03ca6c.png)
|
||||
](https://github.com/goreleaser/releaser/releases)
|
||||
|
||||
And the [homebrew formulae](https://github.com/goreleaser/homebrew-tap/blob/master/release.rb) would look like:
|
||||
And the [Homebrew formulae](https://github.com/goreleaser/homebrew-tap/blob/master/release.rb) would look like:
|
||||
|
||||
```rb
|
||||
class Release < Formula
|
||||
|
Loading…
Reference in New Issue
Block a user