Introduction

LetItGo simplifies automated releases. A simple definition in .release.yml in the root of your project is all you need.

LetItGo prior to version 1.0.0 does not have a stable api. Since 0.5.0 the config format changed. The goal is to keep it stable. But this is not a guaranty.


Example

This example .release.yml shows a few of the features for LetItGo.

letitgo:
  name: letitgo
  description: LetItGo automates releases.
  actions:
    - type: changelog

    - type: githubrelease
      assets:
      - ./build/pkg/*

    - type: homebrew
      homepage: https://github.com/NoUseFreak/letitgo
      url: https://github.com/NoUseFreak/letitgo/releases/download/{{ .Version }}/darwin_amd64.zip
      tap:
        url: git@github.com:NoUseFreak/homebrew-brew.git
      test: system "#{bin}/{{ .Name }} -h"

You can now run LetItGo and make it run the actions.

$ letitgo release

Install

LetItGo supports multiple ways to install and it’s possible to run on a number of platforms.


CLI

Installs the latest release to /usr/local/bin.

$ curl -sL http://bit.ly/gh-get | PROJECT=NoUseFreak/letitgo bash
$ letitgo --version

If you don’t have write permissions to /usr/local/bin. You can overwrite the BIN_DIR.

$ curl -sL http://bit.ly/gh-get | BIN_DIR=/tmp/bin PROJECT=NoUseFreak/letitgo bash
$ /tmp/bin/letitgo --version

Docker

Run the latest version and mount the current directory.

$ docker pull nousefreak/letitgo
$ docker run -v $(pwd):/app nousefreak/letitgo --version

Gifish

Install using gofish.

$ gofish install gofish
$ letitgo --version

Homebrew

Install using the personal tap.

$ brew install NoUseFreak/brew/letitgo
$ letitgo --version

Actions

Actions as as the name explains, actions that letitgo need to execute when the release process is triggered.


Archive

Creates archives of your artifacts.

Configuration

ParameterDescriptionDefault
sourcePath to folders that need to be archived.””
targetTarget directory to place archives.””
extrasList of files to to include in the archive as extras.[]
methodWhat method to use to create the archives.“zip”

Example

    - type: archive
      source: "./build/bin/*"
      target: "./build/pkg/"
      extras:
        - "LICENSE"
        - "CHANGELOG.md"

Changelog

Generate a changelog and commit it to your project.

Prerequisites

  • Requires GITHUB_TOKEN to be set in the environment.

Configuration

ParameterDescriptionDefault
fileFile to place the changelog data.“CHANGELOG.md”
messageCommit message to add to the commit.“Update changelog\n[skip ci]”

Example

    - type changelog:
      file: CHANGELOG.md

Docker

Builds, tags and pushes docker images.

Prerequisites

  • Requires DOCKER_AUTH_PASSWORD to be set in the environment.

Configuration

ParameterDescriptionDefault
imagesList of images.[]
dockerfilePath to Dockerfile.“Dockerfile”
nopushState if we want to push to a registryfalse
auth.usernameUsername of the registry.””
auth.passwordPassword of the registry.””

Example

The following example configuration will update Formula/letitgo.rb.

    - type: docker
      dockerfile: "./Dockerfile"
      images:
        - "nousefreak/test"
        - "nousefreak/test:{{ .Version }}"
        - "nousefreak/test:{{ .Version.Major }}"
        - "nousefreak/test:{{ .Version.Major }}.{{ .Version.Minor }}"
      auth:
        username: nousefreak
      nopush: false

Githubrelease

Publish your artifacts as a github release. It will make on it it does not exist and publish all files matching the assets rules.

Prerequisites

  • Requires GITHUB_TOKEN to be set in the environment.

Configuration

ParameterDescriptionDefault
ownerGithub project owner.””
repoGithub project repository.””
titleTitle of the release.”{{ .Version }}”
descriptionDescription of the release.”{{ .Description }}”
assetsList of assets to attach to the release.[]

Example

    - type: githubrelease
      owner: NoUseFreak
      repo: letitgo
      assets:
        - ./build/pkg/*

Gofish

Create a PR to update gofish lua scripts.

Prerequisites

  • Requires GITHUB_TOKEN to be set in the environment.

Configuration

ParameterDescriptionDefault
githubusernameGithub username to for the gofish-food.””
homepageProject homepage.””
artifactsList of artifact specs.[]
artifacts[].osOs the binary is build for.””
artifacts[].archArchitecture the binary is build for.””
artifacts[].urlUrl where the binary can be downloaded.””

Example

   - type: gofish
      githubusername: NoUseFreak
      homepage: https://github.com/NoUseFreak/letitgo
      artifacts:
        - os: darwin
          arch: amd64
          url: https://github.com/NoUseFreak/letitgo/releases/download/{{ .Version }}/darwin_amd64.zip
        - os: linux
          arch: amd64
          url: https://github.com/NoUseFreak/letitgo/releases/download/{{ .Version }}/linux_amd64.zip

Helm

Package and/or publish helm charts to a registry like chartmuseum.

Prerequisites

  • Requires helm to be installed.

Configuration

ParameterDescriptionDefault
chartsCharts to package.[]
builddirDirectory to package charts in.”./build/helm”
repositoryRepository to publish charts to.””

Example

    - type: helm:
      charts:
        - ./test/test-chart
      builddir: build/helm/
      repository: https://enxmp9berw1vj.x.pipedream.net

Homebrew

Currently it is only supported to update Taps. It requires GITHUB_TOKEN to be set.

Prerequisites

  • Requires GITHUB_TOKEN to be set in the environment.

Configuration

ParameterDescriptionDefault
nameName of the package.””
descriptionDescription of the package.””
urlLink to binary that needs to be added.””
versionVersion of the package”{{ .Version }}”
dependenciesList of dependencies.[]
conflictsList of conflicting packages.[]
tap.urlGit repository to publish to.””
folderFolder to place the homebrew spec.“Formula”
installInstall action“bin.install \“{{ .Name }}\“”
testTest action””

Example

The following example configuration will update Formula/letitgo.rb.

    - type: homebrew:
      homepage: https://github.com/NoUseFreak/letitgo
      url: https://github.com/NoUseFreak/letitgo/releases/download/{{ .Version }}/darwin_amd64.zip
      tap:
        url: git@github.com:NoUseFreak/homebrew-brew.git
      test: system "#{bin}/{{ .Name }} -h"

Slack

Publish a success message when the release completes.

Prerequisites

  • Requires SLACK_TOKEN to be set in the environment.

Configuration

ParameterDescriptionDefault
channelChannel to post to.”#released”
messagePost message.“Project release completed”
authorPost author.“LetItGo”

Example

The following example configuration will post a message to #released.

    - type: slack
      channel: "#released"

Snapcraft

Package and upload your snap to snapcraft.

Prerequisites

  • Requires snapcraft to be installed and logged in.

Configuration

ParameterDescriptionDefault
assetsBinary to package in the snap.[]
architectureType of binary. (all, amd64, i386)””

Example

    - type: snapcraft:
      assets: 
        - build/bin/linux_amd64/letitgo
      architecture: amd64

CLI

Running without an argument, will trigger release.

$ letitgo help
LetItGo release helper

Usage:
  letitgo <version> [flags]
  letitgo [command]

Available Commands:
  help        Help about any command
  init        Init LetItGo config file
  release     Release

Flags:
  -d, --dry-run           Enable dry-run
  -h, --help              help for letitgo
      --loglevel string   Log level (default "info")

Use "letitgo [command] --help" for more information about a command.

Init

$ letitgo init

You can use letitgo init to help you generate your .release.yml file.

It will go through all available actions and provide you with an example for each of the actions.

$ letitgo init
LetItGo
? Project name sawsh
? Project description Simplify
? Enable action snapcraft Yes
? Enable action archive Yes
? Enable action changelog Yes
? Enable action docker No
? Enable action githubrelease No
? Enable action helm No
? Enable action homebrew No

Release

$ letitgo release [version]

If the version is not provided, it will try to find a tag on the current git position.


Continuous integration

To make the build process is documented and versions as much as possible, it is a good idea to include both build and release scripts in the same repository.

$ tree ./scripts/
./scripts/
├── build.sh
├── release.sh
└── test.sh

Example scripts/release.sh.

#!/usr/bin/env bash
#
# This script handles the projects release.

# Get the parent directory of where this script is.
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )"

# Change to the project root.
cd "$DIR"

# Download and run LetItGo
curl -sL http://bit.ly/gh-get | BIN_DIR=/tmp/bin PROJECT=NoUseFreak/letitgo bash
/tmp/bin/letitgo release

Make sure the script is executable.


Travis CI

Setup

Example .travisci.yml file.

# build steps
language: go
go:
- stable

# git settings 
git:
  depth: false # Setting depth to all, needed for changelog generating.

# deploy steps
deploy:
- provider: script
  skip_cleanup: true # keeps any build artifacts around
  script: bash scripts/release.sh
  on:
    repo: NoUseFreak/letitgo
    branch: master
    tags: true

Secrets

If you want to add secrets to the build environment, travis-ci provides a CLI tool to do this.

$ travis encrypt GITHUB_TOKEN=<token> --add