Slide 1

Slide 1 text

BUILDING AND RELEASING GOLANG BINARIES #1 CHANGELOG

Slide 2

Slide 2 text

TEXT $ WHOAMI ▸ Site Reliability Engineer @ ContaAzul ▸ @caarlos0 on twitter, github, etc ▸ Writing stuff in Go since ~2015

Slide 3

Slide 3 text

BUILDING AND RELEASING GOLANG BINARIES #1 CHANGELOG

Slide 4

Slide 4 text

TEXT AGENDA ▸ Building ▸ Releasing ▸ Automation ▸ Questions

Slide 5

Slide 5 text

BUILDING

Slide 6

Slide 6 text

BUILDING CROSS-COMPILING GO ▸ Go can build from and to basically any platform ▸ Statically linked binaries (no deps!!!) ▸ GOOS=windows GOARCH=amd64 go build -o blah_win64
 GOOS=linux GOARCH=amd64 go build -o blah_linux64
 GOOS=darwin GOARCH=amd64 go build -o blah_darwin64
 ...

Slide 7

Slide 7 text

RELEASING

Slide 8

Slide 8 text

RELEASING LINUX PACKAGES ▸ DEB and RPM packages ▸ fpm --a-thousand-params ▸ Snaps ▸ snapcraft --another-thousand-params config.yml

Slide 9

Slide 9 text

RELEASING HOMEBREW ▸ Homebrew core ▸ Harder to get things in there: licensing, replicating dependencies into the recipe, etc ▸ brew install mytool ▸ Homebrew taps ▸ brew install caarlos0/tap/mytool

Slide 10

Slide 10 text

RELEASING DOCKER ▸ FROM scratch
 COPY mybin /
 ENTRYPOINT ["/mybin"] ▸ docker build -t user/img:tag . ▸ docker tag user/img:tag user/img:latest ▸ docker push user/img:tag ▸ docker push user/img:latest

Slide 11

Slide 11 text

RELEASING GITHUB RELEASES ▸ git tag && git push ▸ Upload artifacts ▸ Generate and upload checksums maybe ▸ Edit the release notes

Slide 12

Slide 12 text

"THE PROCESS"

Slide 13

Slide 13 text

TEXT RELEASING MY GO APP THE FIRST TIME: ▸ Tag ▸ Cross compile ▸ Checksums ▸ Release notes ▸ .deb, .rpm, .snap ▸ docker images ▸ Upload ▸ Update homebrew tap

Slide 14

Slide 14 text

HMM, THAT'S ACTUALLY NOT THAT BAD! Carlos Becker TEXT

Slide 15

Slide 15 text

TEXT RELEASING MY GO APP FOR THE 10TH TIME: ▸ Tag ▸ Cross compile ▸ Checksums ▸ Release notes ▸ .deb, .rpm, .snap ▸ docker images ▸ Upload ▸ Update homebrew tap

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

... Carlos Becker TEXT

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

AUTOMATION INTENSIFIES

Slide 24

Slide 24 text

TEXT ./RELEASE.SH ▸ Copy-paste all the commands in one file ▸ chmod +x ▸ ./release.sh

Slide 25

Slide 25 text

TEXT ./RELEASE.SH ▸ No parallelism ▸ Every repo has its own release.sh ▸ GNU vs BSD coreutils aka "Works on my machine" ▸ Random deps or really hacky scripts

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

GORELEASER INTRODUCING

Slide 28

Slide 28 text

GORELEASER FEATURES ▸ Checks git state ▸ Changelog between tags ▸ Builds for several platforms ▸ Archiving (tar.gz, zip) ▸ FPM, Snapcraft and Docker integration ▸ Homebrew taps ▸ Checksums ▸ Snapshots ▸ Fairly customisable

Slide 29

Slide 29 text

GORELEASER INIT ▸ goreleaser init ▸ vim .goreleaser.yml ▸ git add .goreleaser.yml ▸ git commit -m 'goreleaser setup!'

Slide 30

Slide 30 text

GORELEASER RELEASE PROCESS ▸ git tag x.y.z ▸ git push x.y.z ▸ goreleaser

Slide 31

Slide 31 text

GORELEASER CI INTEGRATION ▸ after_success:
 test -n "$TRAVIS_TAG" && curl -fsL https://git.io/goreleaser | bash ▸ Push the tag ▸ Drink some coffee

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

HOW IT WORKS

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

GORELEASER WHY BOTHER ▸ Easy release process ▸ More releases ▸ Smaller changes ▸ Reproducible releases ▸ Fewer and more traceable bugs ▸ Same process across multiple repos ▸ Focus on your code

Slide 40

Slide 40 text

STATS

Slide 41

Slide 41 text

"THATS NICE, BUT NO ONE WILL GIVE A CRAP ABOUT IT ANYWAY..." Carlos Becker TEXT

Slide 42

Slide 42 text

Generated with caarlos0/starcharts

Slide 43

Slide 43 text

Generated with goreleaser/users

Slide 44

Slide 44 text

THANKS!

Slide 45

Slide 45 text

QUESTIONS?

Slide 46

Slide 46 text

GORELEASER LINKS ▸ https://goreleaser.com ▸ #goreleaser on https://gophers.slack.com ▸ https://github.com/goreleaser/goreleaser ▸ https://github.com/goreleaser/users ▸ https://github.com/caarlos0/starcharts ▸ https://brew.sh ▸ http://snapcraft.io ▸ https://github.com/jordansissel/fpm