github.com/droot/goreleaser@v0.66.2-0.20180420030140-c2db5fb17157/docs/020-environment.md (about) 1 --- 2 title: Environment 3 --- 4 5 ## GitHub Token 6 7 GoReleaser requires a GitHub API token with the `repo` scope selected to 8 deploy the artifacts to GitHub. 9 You can create one [here](https://github.com/settings/tokens/new). 10 11 This token should be added to the environment variables as `GITHUB_TOKEN`. 12 Here is how to do it with Travis CI: 13 [Defining Variables in Repository Settings](https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings). 14 15 Alternatively, you can provide the GitHub token in a file. GoReleaser will check `~/.config/goreleaser/github_token` by default, you can change that in 16 the `.goreleaser.yml` file: 17 18 ```yaml 19 # .goreleaser.yml 20 env_files: 21 github_token: ~/.path/to/my/token 22 ``` 23 24 ## GitHub Enterprise 25 26 You can use GoReleaser with GitHub Enterprise by providing its URLs in 27 the `.goreleaser.yml` configuration file: 28 29 ```yaml 30 # .goreleaser.yml 31 github_urls: 32 api: api.github.foo.bar 33 upload: uploads.github.foo.bar 34 download: github.foo.bar 35 ``` 36 37 If none are set, they default to GitHub's public URLs. 38 39 ## The dist folder 40 41 By default, GoReleaser will create its artifacts in the `./dist` folder. 42 If you must, you can change it by setting it in the `.goreleaser.yml` file: 43 44 ```yaml 45 # .goreleaser.yml 46 dist: another-folder-that-is-not-dist 47 ``` 48 49 ## Using the `main.version` 50 51 GoReleaser always sets a `main.version` _ldflag_. 52 You can use it in your `main.go` file: 53 54 ```go 55 package main 56 57 var version = "master" 58 59 func main() { 60 println(version) 61 } 62 ``` 63 64 `version` will be set to the current Git tag (the `v` prefix is stripped) or the name of 65 the snapshot, if you're using the `--snapshot` flag. 66 67 You can override this by changing the `ldflags` option in the `build` section. 68 69 ## Customizing Git 70 71 By default, GoReleaser uses full length commit hashes when setting a `main.commit` 72 _ldflag_ or creating filenames in `--snapshot` mode. 73 74 You can use short, 7 character long commit hashes by setting it in the `.goreleaser.yml`: 75 76 ```yaml 77 # .goreleaser.yml 78 git: 79 short_hash: true 80 ```