2017-09-10 17:07:28 -03:00
---
2017-11-26 21:55:59 -02:00
title: Environment
2017-09-10 17:07:28 -03:00
---
2017-12-04 09:49:29 -02:00
## GitHub Token
2017-09-10 17:07:28 -03:00
2017-10-01 18:57:52 +02:00
GoReleaser requires a GitHub API token with the `repo` scope selected to
deploy the artifacts to GitHub.
You can create one [here ](https://github.com/settings/tokens/new ).
2017-09-10 17:07:28 -03:00
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 ).
2018-02-03 16:47:26 -02:00
Alternatively, you can provide the GitHub token in a file. GoReleaser will check `~/.config/goreleaser/github_token` by default, you can change that in
the `.goreleaser.yml` file:
```yaml
# .goreleaser.yml
env_files:
github_token: ~/.path/to/my/token
```
2018-02-03 00:06:48 -02:00
2018-02-18 20:37:59 -03:00
## GitHub Enterprise
You can use GoReleaser with GitHub Enterprise by providing its URLs in
the `.goreleaser.yml` configuration file:
```yaml
# .goreleaser.yml
github_urls:
api: api.github.foo.bar
upload: uploads.github.foo.bar
download: github.foo.bar
```
If none are set, they default to GitHub's public URLs.
2017-12-04 09:49:29 -02:00
## The dist folder
2017-11-26 21:50:49 -02:00
By default, GoReleaser will create its artifacts in the `./dist` folder.
If you must, you can change it by setting it in the `.goreleaser.yml` file:
```yaml
# .goreleaser.yml
dist: another-folder-that-is-not-dist
```
2017-11-26 21:58:58 -02:00
2017-12-04 09:49:29 -02:00
## Using the `main.version`
2017-11-26 21:58:58 -02:00
2017-12-10 15:17:29 -02:00
GoReleaser always sets a `main.version` _ldflag_ .
2017-11-26 21:58:58 -02:00
You can use it in your `main.go` file:
```go
package main
var version = "master"
func main() {
println(version)
}
```
`version` will be set to the current Git tag (the `v` prefix is stripped) or the name of
the snapshot, if you're using the `--snapshot` flag.
You can override this by changing the `ldflags` option in the `build` section.