This repository was archived by the owner on Mar 15, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +74
-20
lines changed Expand file tree Collapse file tree 4 files changed +74
-20
lines changed Original file line number Diff line number Diff line change @@ -44,12 +44,18 @@ jobs:
44
44
- run :
45
45
name : Code Quality
46
46
command : make lint
47
+ - run :
48
+ name : Release
49
+ command : |
50
+ export GOVERSION=$(go version | awk '{sub("^go","",$3);print $3;}')
51
+ scripts/goreleaser --rm-dist --skip-publish ${CIRCLE_TAG:-"--snapshot"}
52
+ rm -rf $(find ./dist/* -type d) || true
47
53
- store_test_results :
48
54
path : test-results/
49
55
- store_artifacts :
50
56
path : test-results/
51
57
- store_artifacts :
52
- path : /go/bin/vault-plugin-splunk
58
+ path : dist/
53
59
54
60
- save_cache :
55
61
name : Saving Cache for vendor
63
69
- /tmp/go/cache
64
70
65
71
- persist_to_workspace :
66
- root : /go/bin
67
- # Must be relative path from root
68
- paths :
69
- - vault-plugin-splunk
72
+ root : dist/
73
+ paths : .
70
74
71
75
publish-github-release :
72
76
docker :
78
82
name : " Publish Release on GitHub"
79
83
command : |
80
84
go get github.com/tcnksm/ghr
81
- VERSION=$(artifacts/vault-plugin-splunk -version | awk '{print $1}')
82
- zip -jr vault-plugin-splunk artifacts/
83
- ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -recreate ${VERSION} ./vault-plugin-splunk.zip
85
+ VERSION=$(echo artifacts/vault-plugin-splunk_*_*.zip | awk -F_ '{print $2;exit;}')
86
+ ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -recreate ${VERSION} ./artifacts/
84
87
85
88
workflows :
86
89
version : 2
Original file line number Diff line number Diff line change
1
+ before :
2
+ # hooks:
3
+ # # you may remove this if you don't use vgo
4
+ # - go mod download
5
+ builds :
6
+ - main : cmd/vault-plugin-splunk/main.go
7
+ ldflags :
8
+ - -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.goVersion={{.Env.GOVERSION}}
9
+ env :
10
+ - CGO_ENABLED=0
11
+ goos :
12
+ - linux
13
+ - darwin
14
+ goarch :
15
+ - amd64
16
+ archives :
17
+ - replacements :
18
+ 386 : i386
19
+ format : zip
20
+ format_overrides :
21
+ - goos : linux
22
+ format : tar.bz2
23
+ name_template : " {{.ProjectName}}_{{.Version}}_{{.Os}}_{{.Arch}}"
24
+ checksum :
25
+ name_template : ' checksums.txt'
26
+ snapshot :
27
+ name_template : " {{.Version}}-next"
28
+ changelog :
29
+ sort : asc
30
+ filters :
31
+ exclude :
32
+ - ' ^docs:'
33
+ - ' ^test:'
Original file line number Diff line number Diff line change 1
- VERSION := $(shell git describe --tags --always 2>/dev/null)
2
- SHORT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo dev)
3
- GO_VERSION := $(shell go version | awk '{ print $$3}' | sed 's/^go//')
4
-
5
1
TESTREPORT := test-results.xml
6
2
7
3
# XXX BUG(mweber) "go env GOBIN" is empty?
8
4
GOBIN := $(shell go env GOPATH) /bin
9
5
10
- LD_FLAGS_PKG ?= main
11
- LD_FLAGS :=
12
- LD_FLAGS += -X "$(LD_FLAGS_PKG ) .version=$(VERSION ) "
13
- LD_FLAGS += -X "$(LD_FLAGS_PKG ) .commit=$(SHORT_COMMIT ) "
14
- LD_FLAGS += -X "$(LD_FLAGS_PKG ) .goVersion=$(GO_VERSION ) "
15
-
16
6
.PHONY : all
17
7
all : build lint test
18
8
@@ -22,7 +12,7 @@ dep: prereq
22
12
23
13
.PHONY : build
24
14
build : dep vault.hcl
25
- go install -ldflags ' $(LD_FLAGS) ' ./...
15
+ go install ./...
26
16
27
17
vault.hcl : vault.hcl.in
28
18
sed -e ' s;@@GOBIN@@;$(GOBIN);g' < $< > $@
@@ -60,4 +50,4 @@ prereq:
60
50
.PHONY : clean
61
51
clean :
62
52
# XXX clean
63
- rm -rf vault.hcl $(TESTREPORT ) vendor/
53
+ rm -rf vault.hcl $(TESTREPORT ) vendor/ dist/
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ set -e
3
+
4
+ TAR_FILE=" /tmp/goreleaser.tar.gz"
5
+ RELEASES_URL=" https://github.com/goreleaser/goreleaser/releases"
6
+ test -z " $TMPDIR " && TMPDIR=" $( mktemp -d) "
7
+
8
+ last_version () {
9
+ curl -sL -o /dev/null -w %{url_effective} " $RELEASES_URL /latest" |
10
+ rev |
11
+ cut -f1 -d' /' |
12
+ rev
13
+ }
14
+
15
+ download () {
16
+ test -z " $VERSION " && VERSION=" $( last_version) "
17
+ test -z " $VERSION " && {
18
+ echo " Unable to get goreleaser version." >&2
19
+ exit 1
20
+ }
21
+ rm -f " $TAR_FILE "
22
+ curl -s -L -o " $TAR_FILE " \
23
+ " $RELEASES_URL /download/$VERSION /goreleaser_$( uname -s) _$( uname -m) .tar.gz"
24
+ }
25
+
26
+ download
27
+ tar -xf " $TAR_FILE " -C " $TMPDIR "
28
+ " ${TMPDIR} /goreleaser" " $@ "
You can’t perform that action at this time.
0 commit comments