Skip to content

Commit

Permalink
Add release management script
Browse files Browse the repository at this point in the history
  • Loading branch information
rs committed Mar 12, 2018
1 parent 575aa9c commit 246ccc7
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 6 deletions.
20 changes: 14 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
language: go
go:
- "1.8"
- "1.9"
- "1.10"
- '1.8'
- '1.9'
- '1.10'
- master
matrix:
allow_failures:
- go: master
script:
go test -v -race -cpu=1,2,4 -bench . -benchmem ./...
- go: master
script: go test -v -race -cpu=1,2,4 -bench . -benchmem ./...
before_deploy: ./release
deploy:
provider: releases
file_glob: true
file: dist/*
on:
tags: true
api_key:
secure: IkUIPzZ9Nml4dGl6sQH1je0snBe2939+liuAB1IqUTNx+0mlMBC9cSHaHT+5BGL5G1QS31QcgW8jwcdspmHDZTPYkj9tw+GvGIs2nydjruqnhtRdoTeVzRRffZZVqdh1ktao4coZtNam5YlrgWvePhIm6kIYVMBcEgWff+a1/Uw9E3j+Aceo0LA/vrWdjUMNkN+qnKpF5TsNIMDXEwlukWEG1qdQgJZeNMcs/0WgZVrAx0wFsW3kQNdIynbMdY99K2VO90li3D+kSMQquYdcRBaU/ebpP+7mQ9OKTujxCuzU3IWoi05+EtmCDCp24ezL03fcF0UbITz6ORtHv67x36eTie+uXBWOPypiigNzGdtnRV6j2c1PmCxIoReiaLTbtUS9Unl8+87o9WXu0A/oCcN94fN4J19W19LR4npUai+OrrSYJYA8KaORcX//C5jZKcFYK0dFny/nd2sGhCyK81jJsR5Fmp5ePfZ4lhzDS4DrwD+BBO3ulvhmBysX+0tjg5VAKb/2lzZup/dk8Oswco0yi/NOUhf+Nitx9ExAW/ST1qvo7b6V3D8Vq+yXW4FfGheRwF72XzUOpusFdOHVtdShH9lL18Hvv6CUAxv/UjVL6NiCTjXKaKJazmcGbhwTVJOVUG7OmKPDfhmUC6SxhReYkawR3vAyBr8mKHveZD8=
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ Jaggr is a command line tool to aggregate in real time a series of JSON logs. Th

## Install

Direct downloads are available through the [releases page](https://github.com/rs/jaggr/releases/latest).

Using [homebrew](http://brew.sh/) on macOS (Go not required):

```
brew install https://github.com/rs/jaggr/releases/latest/homebrew.rb
```

From source:

```
go get -u github.com/rs/jaggr
```
Expand Down
62 changes: 62 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/bash

set -e

VERSION=$TRAVIS_TAG
USER=rs
NAME=jaggr
DESC="JSON Aggregation CLI"

rm -rf dist
mkdir dist

envs=$(go tool dist list | grep -v android | grep -v darwin/arm | grep -v s390x | grep -v plan9/arm)

for env in $envs; do
eval $(echo $env | tr '/' ' ' | xargs printf 'export GOOS=%s; export GOARCH=%s\n')

GOOS=${env%/*}
GOARCH=${env#*/}

bin=$NAME
if [ $GOOS == "windows" ]; then
bin="$NAME.exe"
fi

mkdir -p dist

echo "Building for GOOS=$GOOS GOARCH=$GOARCH"

CGO_ENABLED=0 go build -o dist/$bin
file=${NAME}_${VERSION}_${GOOS}_${GOARCH}.zip
zip -q dist/$file -j dist/$bin
rm -f dist/$bin
done

url=https://github.com/${USER}/${NAME}/archive/${VERSION}.tar.gz
darwin_amd64=${NAME}_${VERSION}_darwin_amd64.zip
darwin_386=${NAME}_${VERSION}_darwin_386.zip

cat << EOF > dist/homebrew.rb
class $(echo ${NAME:0:1} | tr '[a-z]' '[A-Z]')${NAME:1} < Formula
desc "$DESC"
homepage "https://github.com/${USER}/${NAME}"
url "$url"
sha256 "$(curl -s $url | shasum -a 256 | awk '{print $1}')"
head "https://github.com/${USER}/${NAME}.git"
if Hardware::CPU.is_64_bit?
url "https://github.com/${USER}/${NAME}/releases/download/${VERSION}/${darwin_amd64}"
sha256 "$(shasum -a 256 dist/${darwin_amd64} | awk '{print $1}')"
else
url "https://github.com/${USER}/${NAME}/releases/download/${VERSION}/${darwin_386}"
sha256 "$(shasum -a 256 dist/${darwin_386} | awk '{print $1}')"
end
depends_on "go" => :build
def install
bin.install "$NAME"
end
end
EOF

0 comments on commit 246ccc7

Please sign in to comment.