Skip to content

Commit c3a752c

Browse files
authored
Add Circle-CI (#36)
Add circle-ci
1 parent 8c79c64 commit c3a752c

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

.circleci/config.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
version: 2
2+
jobs:
3+
test:
4+
docker:
5+
- image: circleci/golang:1.12
6+
environment:
7+
GOFLAGS: -mod=vendor
8+
steps:
9+
- checkout
10+
- run: go test -v ./...
11+
release:
12+
docker:
13+
- image: circleci/golang:1.12
14+
steps:
15+
- checkout
16+
- run: ./script/release
17+
workflows:
18+
version: 2
19+
test_and_release:
20+
jobs:
21+
- test
22+
- release:
23+
requires:
24+
- test
25+
filters:
26+
branches:
27+
ignore: /.*/
28+
tags:
29+
only: /v[0-9]+(\.[0-9]+)*(-.*)*/

script/release

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
set -e
3+
TAR_FILE="/tmp/goreleaser.tar.gz"
4+
RELEASES_URL="https://github.com/goreleaser/goreleaser/releases"
5+
test -z "$TMPDIR" && TMPDIR="$(mktemp -d)"
6+
7+
last_version() {
8+
curl -sL -o /dev/null -w %{url_effective} "$RELEASES_URL/latest" |
9+
rev |
10+
cut -f1 -d'/'|
11+
rev
12+
}
13+
14+
download() {
15+
test -z "$VERSION" && VERSION="$(last_version)"
16+
test -z "$VERSION" && {
17+
echo "Unable to get goreleaser version." >&2
18+
exit 1
19+
}
20+
rm -f "$TAR_FILE"
21+
curl -s -L -o "$TAR_FILE" \
22+
"$RELEASES_URL/download/$VERSION/goreleaser_$(uname -s)_$(uname -m).tar.gz"
23+
}
24+
25+
download
26+
tar -xf "$TAR_FILE" -C "$TMPDIR"
27+
"${TMPDIR}/goreleaser" "$@"

0 commit comments

Comments
 (0)