Upgrade to Pro — share decks privately, control downloads, hide ads and more …

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

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

Iskander (Alex) Sharipov

March 15, 2019
Tweet

More Decks by Iskander (Alex) Sharipov

Other Decks in Programming

Transcript

  1. 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/
  2. 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
  3. 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.
  4. 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.
  5. 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]
  6. 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
  7. 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/ • …
  8. 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
  9. 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) }
  10. 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