Go - Create GitHub Releases with GoReleaser

So you just finished your neat little go project and want to distribute it via Github Releases. Fear not! GoReleaser is an amazing tool to get you started with only a few steps.

Requirements:

  • Go
  • Github Repository
  • Github Token

Steps

  1. First of all install the latest version of GoReleaser (for example via go get)

    go get github.com/goreleaser/goreleaser
    
  2. Create your configuration file (.goreleaser.yml). A basic one looks something like this:

    # .goreleaser.yml
    builds:
      - binary: awesome-project
        goos:
          - windows
          - darwin
          - linux
        goarch:
          - amd64
    
  3. Make sure to create a Github Token and add it as an environment variable as GITHUB_TOKEN. Find out how to create your Github Token

    export GITHUB_TOKEN=4a68...
    
  4. Make sure to push at least one tag (GoReleaser uses the latest tag of your repository)

    git tag -a v0.0.1 -m "Release Test"
    git push origin v0.0.1
    
  5. Run GoReleaser

    goreleaser
    
  6. Profit!

You now have your first release for your github repository complete with downloadable versions for multiple plattforms and a Changelog with all your commits since the previous tag.

Conclusion

GoReleaser is an amazing tool which works exceptionally well and was really painless to setup.

Read up on this topic: