From b1aeb915a889e514c1e25d60db552dabf777c4c5 Mon Sep 17 00:00:00 2001 From: Mohamed Gharsallah Date: Tue, 17 Jan 2017 22:34:59 +0100 Subject: [PATCH 1/6] Add documentation --- docs/README.md | 229 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 229 insertions(+) create mode 100644 docs/README.md diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 000000000..b4e7af2db --- /dev/null +++ b/docs/README.md @@ -0,0 +1,229 @@ +GoReleaser builds Go binaries for several platforms, creates a GitHub release and then +pushes a Homebrew formulae to a repository. All that wrapped in your favorite CI. + +[![Release](https://img.shields.io/github/release/goreleaser/goreleaser.svg?style=flat-square)](https://github.com/goreleaser/goreleaser/releases/latest) +[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md) +[![Travis](https://img.shields.io/travis/goreleaser/goreleaser.svg?style=flat-square)](https://travis-ci.org/goreleaser/goreleaser) +[![Go Report Card](https://goreportcard.com/badge/github.com/goreleaser/goreleaser?style=flat-square)](https://goreportcard.com/report/github.com/goreleaser/goreleaser) +[![Powered By: GoReleaser](https://img.shields.io/badge/powered%20by-goreleaser-green.svg?style=flat-square)](https://github.com/goreleaser) + +This project adheres to the Contributor Covenant [code of conduct](https://github.com/goreleaser/goreleaser/blob/master/CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. +We appreciate your contribution. Please refer to our [contributing guidelines](/CONTRIBUTING.md). + +# Documentation + +- [Introduction](#intorduction) +- [Quick start](#quick-start) +- [Environment setup](#environment-setup) +- [Release customization](#release-customization) +- [Integration with CI](#integration-with-ci) + +## Introduction + +GoReleaser is a release automation tool for Golang projects, the goal is to simplify the build, release and publish steps while providing variant customization options for all steps. + +GoReleaser is built for CI tools, you only need a [single command line](#integration-with-ci) in your build script. Therefore, no package is required. +You can define your customization in a `goreleaser.yml` file. For examples, check the [goreleaser.example.yml](https://github.com/goreleaser/goreleaser/blob/master/goreleaser.example.yml) or the [goreleaser.yml](https://github.com/goreleaser/goreleaser/blob/master/goreleaser.yml) used by GoReleaser itself. More on this in [Release customization](#release-customization). +We are also working on integrating package managers, we currently support Homebrew. + +The idea started with a simple shell script ([old GoReleaser](https://github.com/goreleaser/old-go-releaser)), but it quickly became more complex and I also wanted to publish binaries via Homebrew. + +_So, the all-new GoReleaser was born._ + +## Quick start + +In this example, we will build, archive and release a Golang project. +For simplicity, create a GitHub repository and add a single main package: +```go +// main.go +package main + +func main() { + println("Ba dum, tss!") +} +``` +By default, GoReleaser will build the main.go file located in your current directory, but you can change the build package path in a GoReleaser configuration file. + +Speaking of GoReleaser configuration, let's create _goreleaser.yml_ file: + +```yml +# goreleaser.yml +# Build customization +build: + binary_name: drum-roll + goos: + - windows + - darwin + - linux + goarch: + - amd64 +``` + +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 syntax is `{{.BinaryName}}_{{.Os}}_{{.Arch}}`. +You can change the archives name, and format, you can also replace the OS and the Architecture names with your own. +Another useful feature is to add files to archives, this is very useful for integrating assets like resource files. + +```yml +# goreleaser.yml +# Build customization +build: + main: main.go + binary_name: drum-roll + goos: + - windows + - darwin + - linux + goarch: + - amd64 +# Archive customization +archive: + format: tar.gz + replacements: + amd64: 64-bit + darwin: macOS + linux: Tux + files: + - /path/drum-roll.licence.txt +``` + +This configuration will generate tar archives, contains an additional file "drum-roll.licence.txt", the archives will be located in: + "./dist/drum-roll_windows_64-bit.tar.gz" + "./dist/drum-roll_macOS_64-bit.tar.gz" + "./dist/drum-roll_Tux_64-bit.tar.gz" + +Next, you need to export a `GITHUB_TOKEN` environment variable with the `repo` scope selected. This will be used to deploy releases to your GitHub repository. Create yours [here](https://github.com/settings/tokens/new). +```sh +export GITHUB_TOKEN=`YOUR_TOKEN` +``` + +GoReleaser uses the latest [Git tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging) of your repository, +create a tag: +```sh +git tag -a v0.1 -m "First release" +``` + +Now you can run GoReleaser at the root of your repository: +```sh +curl -s https://raw.githubusercontent.com/goreleaser/get/master/latest | bash +``` + +That's it!, check your GitHub release page. +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/goreleaser/releases) + +## Environment setup + +### GitHub Token +GoReleaser, requires GitHub api token with the `repo` scope checked. This will help release the artifacts to GitHub. You can create one [here](https://github.com/settings/tokens/new). +This token should be added to the environment variables as `GITHUB_TOKEN`. Here is how to do it with Travis-ci: [Defining Variables in Repository Settings](https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings). +You can manually export this variable in your build script: +```sh +export GITHUB_TOKEN=`YOUR_TOKEN` +``` +However, exposing your tokens in this method is not recommended. + +### A note about `main.version` + +GoReleaser always sets a `main.version` ldflag. You can use it in your +`main.go` file: + +```go +package main + +var version = "master" + +func main() { + println(version) +} +``` + +And this version will always be the name of the current tag. + +## Release customization + +GoReleaser provides multiple customizations, we will cover them with the help of [goreleaser.example.yml](https://github.com/goreleaser/goreleaser/blob/master/goreleaser.example.yml). +Below is the _goreleaser.yml_ file structure: +```yml +build: + ... +archive: + ... +release: + ... +brew: + ... +``` +### Build +- *main* _(string)_ Path to the main Golang file. By default, the target file is main.go from the current directory. +- *binary_name* _(string)_ Name to be assigned to the binary file in each archive. Default is the name of the project directory. +- *ldflags* _(string)_ Custom Golang ldlags, used in the `go build` command. Default is "-s -w". +- *goos* _(array)_ List of the target operating systems. Default OS are darwin and linux. +- *goarch* _(array)_ List of the target architectures. Default OS are 386 and amd64. + +### Archive +- **name_template** _(string)_ Archive name pattern, the following variables are are available: _BinaryName_ ,_Version_ ,_Os_ ,_Arch_. Default is `{{.BinaryName}}_{{.Os}}_{{.Arch}`. +- **format** _(string)_ Archive format, the following variables are are available: _tar.gz_ and _zip_. Default is "zip". +- **replacements** _(map)_ Replacements for GOOS and GOARCH on the archive name. The keys should be valid GOOS or GOARCH values followed by your custom replacements. +- **files** _(array)_ Additional files you want to add to the archive. Defaults are any files matching "LICENCE*", "LICENSE*", "README*" and "CHANGELOG*" (case-insensitive). + +### Release +- **repo** _(string)_ Target release repository "username/repository". Default is extracted from the origin remote URL. + +### Brew +- **repo** _(string)_ Tap repository "username/homebrew-tap-repository". +- **folder** _(string)_ Folder inside the repository to put the formula. Default is the root folder. +- **caveats** _(string)_ Caveats for the user of your binary. Default is empty. + +By defining the _brew_ property, GoReleaser will take care of publishing the Homebrew tap. + +```yml +... +brew: + repo: user/homebrew-tap-repository + folder: Formula + caveats: "How to use this binary" +``` + +For example, the previous config will generate the next formula in the _Formula_ folder of _homebrew-tap-repository_: + +```rb +class Release < Formula + desc "How to use this binary" + homepage "https://github.com/goreleaser/goreleaser" + url "path-to-release-file" + version "current-version" + sha256 "9ee30fc358fae8d248a2d7538957089885da321dca3f09e3296fe2058e7fff74" + + def install + bin.install "release" + end +end +``` + +## Integration with CI + +You may want to wire this to auto-deploy your new tags on [Travis](https://travis-ci.org), for example: + +```yaml +# .travis.yml +after_success: + test -n "$TRAVIS_TAG" && curl -s https://raw.githubusercontent.com/goreleaser/get/master/latest | bash +``` + +Here is how to do it with [CircleCI](https://circleci.com): +```yml +# circle.yml +deployment: + master: + branch: master + commands: + - curl -s https://raw.githubusercontent.com/goreleaser/get/master/latest | bash +``` + +--- + +Would you like to fix something in the documentation? Feel free to open an [issue](https://github.com/goreleaser/goreleaser/issues). From 498a0a045cf10818598ca68038146a2d2cc220e8 Mon Sep 17 00:00:00 2001 From: Mohamed Gharsallah Date: Wed, 18 Jan 2017 12:14:11 +0100 Subject: [PATCH 2/6] Update docs --- docs/README.md | 72 ++++++++++++++++++++++---------------------------- 1 file changed, 31 insertions(+), 41 deletions(-) diff --git a/docs/README.md b/docs/README.md index b4e7af2db..928cd0319 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,5 +1,5 @@ GoReleaser builds Go binaries for several platforms, creates a GitHub release and then -pushes a Homebrew formulae to a repository. All that wrapped in your favorite CI. +pushes a Homebrew formula to a repository. All that wrapped in your favorite CI. [![Release](https://img.shields.io/github/release/goreleaser/goreleaser.svg?style=flat-square)](https://github.com/goreleaser/goreleaser/releases/latest) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md) @@ -42,9 +42,7 @@ func main() { println("Ba dum, tss!") } ``` -By default, GoReleaser will build the main.go file located in your current directory, but you can change the build package path in a GoReleaser configuration file. - -Speaking of GoReleaser configuration, let's create _goreleaser.yml_ file: +By default, GoReleaser will build the *main.go* file located in your current directory, but you can change the build package path in the GoReleaser configuration file. ```yml # goreleaser.yml @@ -61,8 +59,8 @@ build: 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 syntax is `{{.BinaryName}}_{{.Os}}_{{.Arch}}`. -You can change the archives name, and format, you can also replace the OS and the Architecture names with your own. +GoReleaser will then archive the result binaries of each Os/Arch into a separate file. The default format is `{{.BinaryName}}_{{.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. ```yml @@ -98,8 +96,8 @@ Next, you need to export a `GITHUB_TOKEN` environment variable with the `repo` s export GITHUB_TOKEN=`YOUR_TOKEN` ``` -GoReleaser uses the latest [Git tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging) of your repository, -create a tag: +GoReleaser uses the latest [Git tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging) of your repository. +Create a tag: ```sh git tag -a v0.1 -m "First release" ``` @@ -118,13 +116,8 @@ The release on GitHub looks pretty much like this: ## Environment setup ### GitHub Token -GoReleaser, requires GitHub api token with the `repo` scope checked. This will help release the artifacts to GitHub. You can create one [here](https://github.com/settings/tokens/new). +GoReleaser requires a GitHub API token with the `repo` scope checked to deploy the artefacts to GitHub. You can create one [here](https://github.com/settings/tokens/new). This token should be added to the environment variables as `GITHUB_TOKEN`. Here is how to do it with Travis-ci: [Defining Variables in Repository Settings](https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings). -You can manually export this variable in your build script: -```sh -export GITHUB_TOKEN=`YOUR_TOKEN` -``` -However, exposing your tokens in this method is not recommended. ### A note about `main.version` @@ -141,12 +134,12 @@ func main() { } ``` -And this version will always be the name of the current tag. +`version` will always be the name of the current Git tag. ## Release customization -GoReleaser provides multiple customizations, we will cover them with the help of [goreleaser.example.yml](https://github.com/goreleaser/goreleaser/blob/master/goreleaser.example.yml). -Below is the _goreleaser.yml_ file structure: +GoReleaser provides multiple customizations. We will cover them with the help of [goreleaser.example.yml](https://github.com/goreleaser/goreleaser/blob/master/goreleaser.example.yml). +The _goreleaser.yml_ file is structured like this: ```yml build: ... @@ -157,41 +150,38 @@ release: brew: ... ``` -### Build -- *main* _(string)_ Path to the main Golang file. By default, the target file is main.go from the current directory. -- *binary_name* _(string)_ Name to be assigned to the binary file in each archive. Default is the name of the project directory. -- *ldflags* _(string)_ Custom Golang ldlags, used in the `go build` command. Default is "-s -w". -- *goos* _(array)_ List of the target operating systems. Default OS are darwin and linux. -- *goarch* _(array)_ List of the target architectures. Default OS are 386 and amd64. -### Archive -- **name_template** _(string)_ Archive name pattern, the following variables are are available: _BinaryName_ ,_Version_ ,_Os_ ,_Arch_. Default is `{{.BinaryName}}_{{.Os}}_{{.Arch}`. -- **format** _(string)_ Archive format, the following variables are are available: _tar.gz_ and _zip_. Default is "zip". -- **replacements** _(map)_ Replacements for GOOS and GOARCH on the archive name. The keys should be valid GOOS or GOARCH values followed by your custom replacements. -- **files** _(array)_ Additional files you want to add to the archive. Defaults are any files matching "LICENCE*", "LICENSE*", "README*" and "CHANGELOG*" (case-insensitive). - -### Release -- **repo** _(string)_ Target release repository "username/repository". Default is extracted from the origin remote URL. - -### Brew -- **repo** _(string)_ Tap repository "username/homebrew-tap-repository". -- **folder** _(string)_ Folder inside the repository to put the formula. Default is the root folder. -- **caveats** _(string)_ Caveats for the user of your binary. Default is empty. +| Section | Option | Type | Description | Default | +| --- | --- | --- | --- | --- | +| `build` | main | String | Path to the main Golang file | `main.go` in current directory | +| `build` | binary_name | String | Name to be assigned to the binary file in each archive | Name of the project | +| `build` | ldflags | String | Custom Golang ldlags, used in the "go build" command | `-s -w` | +| `build` | goos | Array | List of the target operating systems | `[darwin, linux]` | +| `build` | goarch | Array | List of the target architectures | `[386, amd64]` | +| `archive` | name_template | String | Archive name pattern, the following variables are available: _BinaryName_ ,_Version_ ,_Os_ ,_Arch_ | `{{.BinaryName}}_{{.Os}}_{{.Arch}` | +| `archive` | format | String | Archive format, the following variables are available: _tar.gz_ and _zip_ | `zip` | +| `archive` | replacements | Map | Replacements for GOOS and GOARCH on the archive name. The keys should be valid GOOS or GOARCH values followed by your custom replacements | | +| `archive` | files | Array | Additional files you want to add to the archive | `LICENCE*`, `LICENSE*`, `README*` and `CHANGELOG*` (case-insensitive) | +| `release` | repo | String | Target release repository "username/repository" | Username and repository of the origin remote URL | +| `brew` | repo | String | Tap repository "username/homebrew-tap-repository" | | +| `brew` | folder | String | Folder inside the repository to put the formula | Root folder | +| `brew` | caveats | String | Caveats for the user of your binary | | By defining the _brew_ property, GoReleaser will take care of publishing the Homebrew tap. - +Add here for example below: ```yml -... +build: + binary_name: mybin brew: repo: user/homebrew-tap-repository folder: Formula caveats: "How to use this binary" ``` -For example, the previous config will generate the next formula in the _Formula_ folder of _homebrew-tap-repository_: +For example, the above config will generate a mybin.rb formula in the _Formula_ folder of _homebrew-tap-repository_: ```rb -class Release < Formula +class Mybin < Formula desc "How to use this binary" homepage "https://github.com/goreleaser/goreleaser" url "path-to-release-file" @@ -199,7 +189,7 @@ class Release < Formula sha256 "9ee30fc358fae8d248a2d7538957089885da321dca3f09e3296fe2058e7fff74" def install - bin.install "release" + bin.install "mybin" end end ``` From 45f7d5c2445c969bab1787c64c51cdde92c0b000 Mon Sep 17 00:00:00 2001 From: Mohamed Gharsallah Date: Sat, 21 Jan 2017 15:02:10 +0100 Subject: [PATCH 3/6] Update docs --- docs/README.md | 157 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 109 insertions(+), 48 deletions(-) diff --git a/docs/README.md b/docs/README.md index 928cd0319..b927fd853 100644 --- a/docs/README.md +++ b/docs/README.md @@ -7,8 +7,8 @@ pushes a Homebrew formula to a repository. All that wrapped in your favorite CI. [![Go Report Card](https://goreportcard.com/badge/github.com/goreleaser/goreleaser?style=flat-square)](https://goreportcard.com/report/github.com/goreleaser/goreleaser) [![Powered By: GoReleaser](https://img.shields.io/badge/powered%20by-goreleaser-green.svg?style=flat-square)](https://github.com/goreleaser) -This project adheres to the Contributor Covenant [code of conduct](https://github.com/goreleaser/goreleaser/blob/master/CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. -We appreciate your contribution. Please refer to our [contributing guidelines](/CONTRIBUTING.md). +This project adheres to the Contributor Covenant [code of conduct](../CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. +We appreciate your contribution. Please refer to our [contributing guidelines](../CONTRIBUTING.md). # Documentation @@ -22,18 +22,18 @@ We appreciate your contribution. Please refer to our [contributing guidelines](/ GoReleaser is a release automation tool for Golang projects, the goal is to simplify the build, release and publish steps while providing variant customization options for all steps. -GoReleaser is built for CI tools, you only need a [single command line](#integration-with-ci) in your build script. Therefore, no package is required. -You can define your customization in a `goreleaser.yml` file. For examples, check the [goreleaser.example.yml](https://github.com/goreleaser/goreleaser/blob/master/goreleaser.example.yml) or the [goreleaser.yml](https://github.com/goreleaser/goreleaser/blob/master/goreleaser.yml) used by GoReleaser itself. More on this in [Release customization](#release-customization). +GoReleaser is built for CI tools; you only need a [single command line](#integration-with-ci) in your build script. Therefore, no package is required. +You can define your [customization](#release-customization) in a `goreleaser.yml` file. We are also working on integrating package managers, we currently support Homebrew. -The idea started with a simple shell script ([old GoReleaser](https://github.com/goreleaser/old-go-releaser)), but it quickly became more complex and I also wanted to publish binaries via Homebrew. +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. _So, the all-new GoReleaser was born._ ## Quick start -In this example, we will build, archive and release a Golang project. -For simplicity, create a GitHub repository and add a single main package: +In this example we will build, archive and release a Golang project. +Create a GitHub repository and add a single main package: ```go // main.go package main @@ -42,7 +42,7 @@ func main() { println("Ba dum, tss!") } ``` -By default, GoReleaser will build the *main.go* file located in your current directory, but you can change the build package path in the GoReleaser configuration file. +By default GoReleaser will build the **main.go** file located in your current directory, but you can change the build package path in the GoReleaser configuration file. ```yml # goreleaser.yml @@ -83,15 +83,15 @@ archive: darwin: macOS linux: Tux files: - - /path/drum-roll.licence.txt + - drum-roll.licence.txt ``` -This configuration will generate tar archives, contains an additional file "drum-roll.licence.txt", the archives will be located in: +This configuration will generate tar archives, contains an additional file "drum-roll.licence.txt", the archives will be located in: "./dist/drum-roll_windows_64-bit.tar.gz" "./dist/drum-roll_macOS_64-bit.tar.gz" "./dist/drum-roll_Tux_64-bit.tar.gz" -Next, you need to export a `GITHUB_TOKEN` environment variable with the `repo` scope selected. This will be used to deploy releases to your GitHub repository. Create yours [here](https://github.com/settings/tokens/new). +Next export a `GITHUB_TOKEN` environment variable with the `repo` scope selected. This will be used to deploy releases to your GitHub repository. Create yours [here](https://github.com/settings/tokens/new). ```sh export GITHUB_TOKEN=`YOUR_TOKEN` ``` @@ -107,8 +107,8 @@ Now you can run GoReleaser at the root of your repository: curl -s https://raw.githubusercontent.com/goreleaser/get/master/latest | bash ``` -That's it!, check your GitHub release page. -The release on GitHub looks pretty much like this: +That's it! Check your GitHub release page. +The release on will look like this: [![image](https://cloud.githubusercontent.com/assets/245435/21578845/09404c8a-cf78-11e6-92d7-165ddc03ca6c.png) ](https://github.com/goreleaser/goreleaser/releases) @@ -138,58 +138,119 @@ func main() { ## Release customization -GoReleaser provides multiple customizations. We will cover them with the help of [goreleaser.example.yml](https://github.com/goreleaser/goreleaser/blob/master/goreleaser.example.yml). -The _goreleaser.yml_ file is structured like this: +GoReleaser provides multiple customizations. We will cover them with the help of _goreleaser.yml_: + ```yml +# goreleaser.yml +# Build customization build: - ... + # Path to main.go file. + # Default is `main.go` + main: ./cmd/main.go + + # Name of the binary. Default is the name of the project directory. + binary_name: program + + # Custom ldflags. + # Default is `-s -w` + ldflags: -s -w + + # GOOS list to build in. + # For more info refer to https://golang.org/doc/install/source#environment + # Defaults are darwin and linux + goos: + - freebsd + - windows + + # GOARCH to build in. + # For more info refer to https://golang.org/doc/install/source#environment + # Defaults are 386 and amd64 + goarch: + - amd64 + + +# Archive customization archive: - ... + # You can change the name of the archive. + # This is parsed with Golang template engine and the following variables + # are available: + # - BinaryName + # - Version + # - Os + # - Arch + # The default is `{{.BinaryName}}_{{.Os}}_{{.Arch}}` + name_template: "{{.BinaryName}}_{{.Version}}_{{.Os}}_{{.Arch}}" + + # Archive format. Valid options are `tar.gz` and `zip`. + # Default is `tar.gz` + format: zip + + # Replacements for GOOS and GOARCH on the archive name. + # The keys should be valid GOOS or GOARCH values followed by your custom + # replacements. + # By default, `replacements` replace GOOS and GOARCH values with valid outputs + # of `uname -s` and `uname -m` respectively. + replacements: + amd64: 64-bit + 386: 32-bit + darwin: macOS + linux: Tux + + # Additional files you want to add to the archive. + # Defaults are any files matching `LICENCE*`, `LICENSE*`, + # `README*` and `CHANGELOG*` (case-insensitive) + files: + - LICENSE.txt + - README.md + - CHANGELOG.md + + +# Release customization release: - ... -brew: - ... -``` + # Repo in which the release will be created. + # Default is extracted from the origin remote URL. + repo: user/repo -| Section | Option | Type | Description | Default | -| --- | --- | --- | --- | --- | -| `build` | main | String | Path to the main Golang file | `main.go` in current directory | -| `build` | binary_name | String | Name to be assigned to the binary file in each archive | Name of the project | -| `build` | ldflags | String | Custom Golang ldlags, used in the "go build" command | `-s -w` | -| `build` | goos | Array | List of the target operating systems | `[darwin, linux]` | -| `build` | goarch | Array | List of the target architectures | `[386, amd64]` | -| `archive` | name_template | String | Archive name pattern, the following variables are available: _BinaryName_ ,_Version_ ,_Os_ ,_Arch_ | `{{.BinaryName}}_{{.Os}}_{{.Arch}` | -| `archive` | format | String | Archive format, the following variables are available: _tar.gz_ and _zip_ | `zip` | -| `archive` | replacements | Map | Replacements for GOOS and GOARCH on the archive name. The keys should be valid GOOS or GOARCH values followed by your custom replacements | | -| `archive` | files | Array | Additional files you want to add to the archive | `LICENCE*`, `LICENSE*`, `README*` and `CHANGELOG*` (case-insensitive) | -| `release` | repo | String | Target release repository "username/repository" | Username and repository of the origin remote URL | -| `brew` | repo | String | Tap repository "username/homebrew-tap-repository" | | -| `brew` | folder | String | Folder inside the repository to put the formula | Root folder | -| `brew` | caveats | String | Caveats for the user of your binary | | -By defining the _brew_ property, GoReleaser will take care of publishing the Homebrew tap. -Add here for example below: -```yml -build: - binary_name: mybin +# The brew section specifies how the formula should be created +# Check this link for details: https://github.com/Homebrew/brew/blob/master/docs/How-to-Create-and-Maintain-a-Tap.md brew: - repo: user/homebrew-tap-repository + # Reporitory to push the tap to. + repo: user/homebrew-tap + + # Folder inside the repository to put the formula. + # Default is the root folder. folder: Formula + + # Caveats for the user of your binary. + # Default is empty. caveats: "How to use this binary" + + # Dependencies of your formula. + # For more info, check https://github.com/Homebrew/brew/blob/master/docs/Formula-Cookbook.md + dependencies: + - pkg-config + - jpeg + - boost + - readline + - gtk+ + - x11 + ``` -For example, the above config will generate a mybin.rb formula in the _Formula_ folder of _homebrew-tap-repository_: +By defining the _brew_ property, GoReleaser will take care of publishing the Homebrew tap. +Assuming that the current tag is `v1.2.3`, the above config will generate a _program.rb_ formula in the _Formula_ folder of _homebrew-tap_ repository: ```rb -class Mybin < Formula +class Program < Formula desc "How to use this binary" - homepage "https://github.com/goreleaser/goreleaser" - url "path-to-release-file" - version "current-version" + homepage "https://github.com/user/homebrew-tap" + url "https://github.com/user/repo/releases/download/{version}/program_v1.2.3_macOs_64bit.zip" + version "v1.2.3" sha256 "9ee30fc358fae8d248a2d7538957089885da321dca3f09e3296fe2058e7fff74" def install - bin.install "mybin" + bin.install "program" end end ``` From d88947c238423486cc9e3b9d4ccf6506c919a888 Mon Sep 17 00:00:00 2001 From: Mohamed Gharsallah Date: Sat, 21 Jan 2017 15:34:00 +0100 Subject: [PATCH 4/6] Remove goreleaser example file --- goreleaser.example.yml | 94 ------------------------------------------ goreleaser.yml | 1 - 2 files changed, 95 deletions(-) delete mode 100644 goreleaser.example.yml diff --git a/goreleaser.example.yml b/goreleaser.example.yml deleted file mode 100644 index 781a22215..000000000 --- a/goreleaser.example.yml +++ /dev/null @@ -1,94 +0,0 @@ -# Build customization -build: - # Path to main.go file. - # Default is `main.go` - main: ./cmd/main.go - - # Name of the binary. Default is the name of the project directory. - binary_name: program - - # Custom ldflags. - # Default is `-s -w` - ldflags: -s -w - - # GOOS list to build in. - # For more info refer to https://golang.org/doc/install/source#environment - # Defaults are darwin and linux - goos: - - freebsd - - windows - - # GOARCH to build in. - # For more info refer to https://golang.org/doc/install/source#environment - # Defaults are 386 and amd64 - goarch: - - amd64 - - -# Archive customization -archive: - # You can change the name of the archive. - # This is parsed with Golang template engine and the following variables - # are available: - # - BinaryName - # - Version - # - Os - # - Arch - # The default is `{{.BinaryName}}_{{.Os}}_{{.Arch}}` - name_template: "{{.BinaryName}}_{{.Version}}_{{.Os}}_{{.Arch}}" - - # Archive format. Valid options are `tar.gz` and `zip`. - # Default is `zip` - format: zip - - # Replacements for GOOS and GOARCH on the archive name. - # The keys should be valid GOOS or GOARCH values followed by your custom - # replacements. - # By default, `replacements` replace GOOS and GOARCH values with valid outputs - # of `uname -s` and `uname -m` respectively. - replacements: - amd64: 64-bit - 386: 32-bit - darwin: macOS - linux: Tux - - # Additional files you want to add to the archive. - # Defaults are any files matching `LICENCE*`, `LICENSE*`, - # `README*` and `CHANGELOG*` (case-insensitive) - files: - - LICENSE.txt - - README.md - - CHANGELOG.md - - -# Release customization -release: - # Repo in which the release will be created. - # Default is extracted from the origin remote URL. - repo: user/repo - - -# The brew section specifies how the formula should be created -# Check this link for details: https://github.com/Homebrew/brew/blob/master/docs/How-to-Create-and-Maintain-a-Tap.md -brew: - # Reporitory to push the tap to. - repo: user/homebrew-tap - - # Folder inside the repository to put the formula. - # Default is the root folder. - folder: Formula - - # Caveats for the user of your binary. - # Default is empty. - caveats: "How to use this binary" - - # Dependencies of your formula. - # For more info, check https://github.com/Homebrew/brew/blob/master/docs/Formula-Cookbook.md - dependencies: - - pkg-config - - jpeg - - boost - - readline - - gtk+ - - x11 - diff --git a/goreleaser.yml b/goreleaser.yml index d955edf1c..68d478b0c 100644 --- a/goreleaser.yml +++ b/goreleaser.yml @@ -7,4 +7,3 @@ archive: files: - README.md - LICENSE.md - - goreleaser.example.yml From 1a25792e6f32f879e9ac46cd36d2091fb9f1255c Mon Sep 17 00:00:00 2001 From: Mohamed Gharsallah Date: Sat, 21 Jan 2017 15:34:40 +0100 Subject: [PATCH 5/6] Add documentation link --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6577fb46d..d42e68744 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ By participating, you are expected to uphold this code. Please report unacceptab [![Release](https://img.shields.io/github/release/goreleaser/goreleaser.svg?style=flat-square)](https://github.com/goreleaser/goreleaser/releases/latest) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md) [![Travis](https://img.shields.io/travis/goreleaser/goreleaser.svg?style=flat-square)](https://travis-ci.org/goreleaser/goreleaser) -[![Go Report Card](https://goreportcard.com/badge/github.com/goreleaser/goreleaser?style=flat-square)](https://goreportcard.com/report/github.com/goreleaser/goreleaser) +[![Go Report Card](https://goreportcard.com/badge/github.com/goreleaser/goreleaser?style=flat-square)](https://goreportcard.com/report/github.com/goreleaser/goreleaser) [![Powered By: GoReleaser](https://img.shields.io/badge/powered%20by-goreleaser-green.svg?style=flat-square)](https://github.com/goreleaser) ## Why? @@ -22,6 +22,10 @@ Homebrew. So, the all-new GoReleaser was born. +## Documentation + +For Documentation, visit the [GoReleaser website](https://goreleaser.github.io/documentation/) or our GitHub [here](/docs). + ## Usage - You need to export a `GITHUB_TOKEN` environment variable with @@ -47,7 +51,7 @@ Of course, all this can be customized! For customization create a `goreleaser.yml` file in the root of your repository. -A complete and commented example can be found [here](/goreleaser.example.yml). +A complete and commented example can be found in the [documentation](/docs/#release-customization). You can also check the [goreleaser.yml](/goreleaser.yml) used by GoReleaser itself. From ccebd4e26efd672dca0f8436dd8c0dfd7d2101b5 Mon Sep 17 00:00:00 2001 From: Mohamed Gharsallah Date: Sat, 21 Jan 2017 15:37:24 +0100 Subject: [PATCH 6/6] Typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d42e68744..054167f37 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ So, the all-new GoReleaser was born. ## Documentation -For Documentation, visit the [GoReleaser website](https://goreleaser.github.io/documentation/) or our GitHub [here](/docs). +For Documentation, visit the [GoReleaser website](https://goreleaser.github.io/documentation/) or our GitHub [docs](/docs). ## Usage