Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

build Golang release binaries for Github

Tags:

github

go

I'm looking for ideas on how to easily build binaries for common platforms for a Golang project, for release on Github.

I already know how to manually do releases, using Github's instructions at Creating Releases. And I'm currently doing releases using aktau/github-release, but this requires manually logging into different machines (OSX, Linux, Windows) and doing the release.

Benedikt Lang has blogged about using Travis-CI (which I'm yet to experiment with). But I presume the public Travis will only build binaries for Linux.

Any suggestions?

like image 576
Sonia Hamilton Avatar asked Aug 05 '15 10:08

Sonia Hamilton


1 Answers

You are most likely right about the Travis CI only building in Linux as go cross-compilation requires you to build from source and build other go executables. Like RoninDev suggested, I would suggest that you setup your own cross-compilation build environment by following the blog post:

http://dave.cheney.net/2012/09/08/an-introduction-to-cross-compilation-with-go

It is quite easy, and only takes about 10 minutes. After you have that, a build tool such as Jenkins will give you the controls to kick off a build for the desired platforms (Mac, Windows, Linux, etc) and then push out git releases for each one.

like image 170
JD D Avatar answered Oct 07 '22 09:10

JD D