$30 off During Our Annual Pro Sale. View Details »

Подготовка релизов с goreleaser

Подготовка релизов с goreleaser

Iskander (Alex) Sharipov

March 15, 2019

More Decks by Iskander (Alex) Sharipov

Other Decks in Programming


  1. Make your releases in a proper way* * with GoReleaser

  2. Anton Kucherov Software Engineer at

  3. 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/
  4. 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
  5. The Goal → →

  6. 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.
  7. None
  8. None
  9. Semantic Versioning https://semver.org/ v1.2.3-rc1+20190315.5114f85 v2.0.1 v0.3.6-alfa

  10. None
  11. 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.
  12. Conventional Commits https://www.conventionalcommits.org/ A specification for adding human and machine

    readable meaning to commit messages <type>[optional scope]: <description> [optional body] [optional footer]
  13. None
  14. 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
  15. Basic Artifacts

  16. 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/ • …
  17. Objectives - Semantic versions - Awesome changelog - Easy to

  18. The End Questions?

  19. 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
  20. 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) }
  21. 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
  22. Changelog Generation $ goreleaser --release-notes <(some_changelog_generator)