Skip to content

Commit

Permalink
Add Circle-CI (#36)
Browse files Browse the repository at this point in the history
Add circle-ci
  • Loading branch information
bakins committed May 1, 2019
1 parent 8c79c64 commit c3a752c
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: 2
jobs:
test:
docker:
- image: circleci/golang:1.12
environment:
GOFLAGS: -mod=vendor
steps:
- checkout
- run: go test -v ./...
release:
docker:
- image: circleci/golang:1.12
steps:
- checkout
- run: ./script/release
workflows:
version: 2
test_and_release:
jobs:
- test
- release:
requires:
- test
filters:
branches:
ignore: /.*/
tags:
only: /v[0-9]+(\.[0-9]+)*(-.*)*/
27 changes: 27 additions & 0 deletions script/release
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
set -e
TAR_FILE="/tmp/goreleaser.tar.gz"
RELEASES_URL="https://github.com/goreleaser/goreleaser/releases"
test -z "$TMPDIR" && TMPDIR="$(mktemp -d)"

last_version() {
curl -sL -o /dev/null -w %{url_effective} "$RELEASES_URL/latest" |
rev |
cut -f1 -d'/'|
rev
}

download() {
test -z "$VERSION" && VERSION="$(last_version)"
test -z "$VERSION" && {
echo "Unable to get goreleaser version." >&2
exit 1
}
rm -f "$TAR_FILE"
curl -s -L -o "$TAR_FILE" \
"$RELEASES_URL/download/$VERSION/goreleaser_$(uname -s)_$(uname -m).tar.gz"
}

download
tar -xf "$TAR_FILE" -C "$TMPDIR"
"${TMPDIR}/goreleaser" "$@"

0 comments on commit c3a752c

Please sign in to comment.