Slide 1

Slide 1 text

Make your releases in a proper way* * with GoReleaser

Slide 2

Slide 2 text

Anton Kucherov Software Engineer at

Slide 3

Slide 3 text

GoReleaser GoReleaser is a release automation tool for Go projects, the goal is to simplify the build, release and publish steps while providing variant customization options for all steps. https://goreleaser.com/

Slide 4

Slide 4 text

Basic Usage $ goreleaser init $ export GITHUB_TOKEN=`YOUR_TOKEN` $ git tag -a v0.1.0 -m "First release" $ git push origin v0.1.0 $ goreleaser

Slide 5

Slide 5 text

The Goal → →

Slide 6

Slide 6 text

Difficulties - There are no versions
 What if it would kick me straight into dependency hell? - There is no changelog
 There was fixed some critical security problems or only new features was added, or maybe it was just caused by docs update? Should I update? - It is hard to install
 Build that stuff from sources. What? No way.

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

Semantic Versioning https://semver.org/ v1.2.3-rc1+20190315.5114f85 v2.0.1 v0.3.6-alfa

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

Keep a ChangeLog https://keepachangelog.com/en/1.0.0/ What is a changelog? A changelog is a file which contains a curated, chronologically ordered list of notable changes for each version of a project. Why keep a changelog? To make it easier for users and contributors to see precisely what notable changes have been made between each release (or version) of the project. Who needs a changelog? People do. Whether consumers or developers, the end users of software are human beings who care about what's in the software. When the software changes, people want to know why and how.

Slide 12

Slide 12 text

Conventional Commits https://www.conventionalcommits.org/ A specification for adding human and machine readable meaning to commit messages [optional scope]: [optional body] [optional footer]

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

Which one? • rpm, deb packages • docker image • homebrew formula • binary executables A B C • binary executables • source code • source code* * build that shit by yourself

Slide 15

Slide 15 text

Basic Artifacts

Slide 16

Slide 16 text

Packaging • nfpm (.dep, .rpm) • SnapCraft • Homebrew • Scoop • S3 • Artifactory • Bintray • Docker • HTTP Put • https://github.com/goreleaser/nfpm • https://snapcraft.io/ • https://brew.sh/ • https://scoop.sh/ • https://aws.amazon.com/s3/ • https://jfrog.com/artifactory/ • https://bintray.com/ • https://hub.docker.com/ • …

Slide 17

Slide 17 text

Objectives - Semantic versions - Awesome changelog - Easy to install

Slide 18

Slide 18 text

The End Questions?

Slide 19

Slide 19 text

How to Install # homebrew $ brew install goreleaser/tap/goreleaser # or $ brew install goreleaser # snapcraft $ snap install goreleaser # scoop $ scoop bucket add goreleaser https://github.com/ \ goreleaser/scoop-bucket.git $ scoop install goreleaser # deb/rpm packages $ https://github.com/goreleaser/goreleaser/releases/ \ download/v0.102.0/goreleaser_amd64.deb # docker image $ docker pull goreleaser/goreleaser:latest

Slide 20

Slide 20 text

Version Info package main import "fmt" var ( version = "dev" commit = "none" date = "unknown" ) func main() { fmt.Printf("%v, commit %v, built at %v", version, commit, date) }

Slide 21

Slide 21 text

Template variables Key Description .ProjectName the project name .Version the version being released (v prefix stripped) .Tag the current git tag .ShortCommit the git commit short hash .FullCommit the git commit full hash .Commit the git commit hash (deprecated) .GitURL the git remote url .Major the major part of the version .Minor the minor part of the version .Patch the patch part of the version .Env a map with system’s environment variables .Date current UTC date in RFC3339 format .Timestamp current UTC time in Unix format

Slide 22

Slide 22 text

Changelog Generation $ goreleaser --release-notes <(some_changelog_generator)