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. Make your releases in a
    proper way*
    * with GoReleaser

    View Slide

  2. Anton Kucherov
    Software Engineer at

    View Slide

  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/

    View Slide

  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

    View Slide

  5. The Goal

    → →

    View Slide

  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.

    View Slide

  7. View Slide

  8. View Slide

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

    View Slide

  10. View Slide

  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.

    View Slide

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

    View Slide

  13. View Slide

  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

    View Slide

  15. Basic Artifacts

    View Slide

  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/
    • …

    View Slide

  17. Objectives
    - Semantic versions
    - Awesome changelog
    - Easy to install

    View Slide

  18. The End
    Questions?

    View Slide

  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

    View Slide

  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)
    }

    View Slide

  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

    View Slide

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

    View Slide