forked from rancher/stern
-
Notifications
You must be signed in to change notification settings - Fork 96
/
wercker.yml
102 lines (85 loc) · 3.83 KB
/
wercker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
box: golang:1.8
build:
base-path: /go/src/github.com/wercker/stern
steps:
- script:
name: install govendor
code: go get -u github.com/kardianos/govendor
- script:
name: go vet
code: govendor vet +local
- script:
name: install dependencies
code: govendor sync
- script:
name: go build linux amd64
code: |
export CGO_ENABLED=0
GOOS=linux GOARCH=amd64 go build \
-ldflags="-s -X github.com/wercker/stern.GitCommit=$WERCKER_GIT_COMMIT -X github.com/wercker/stern.PatchVersion=$(( ($(date +%s) - $(date --date=20150101 +%s) )/(60*60*24) )) -X github.com/wercker/stern.Compiled=$(date +%s)" \
-installsuffix cgo \
-o $WERCKER_OUTPUT_DIR/artifacts/latest/linux_amd64/stern
cp $WERCKER_OUTPUT_DIR/artifacts/latest/linux_amd64/stern $WERCKER_REPORT_ARTIFACTS_DIR
- script:
name: go build darwin amd64
code: |
export CGO_ENABLED=0
GOOS=darwin GOARCH=amd64 go build \
-ldflags="-s -X github.com/wercker/stern.GitCommit=$WERCKER_GIT_COMMIT -X github.com/wercker/stern.PatchVersion=$(( ($(date +%s) - $(date --date=20150101 +%s) )/(60*60*24) )) -X github.com/wercker/stern.Compiled=$(date +%s)" \
-installsuffix cgo \
-o $WERCKER_OUTPUT_DIR/artifacts/latest/darwin_amd64/stern
cp $WERCKER_OUTPUT_DIR/artifacts/latest/darwin_amd64/stern $WERCKER_REPORT_ARTIFACTS_DIR
- script:
name: go build windows amd64
code: |
export CGO_ENABLED=0
GOOS=windows GOARCH=amd64 go build \
-ldflags="-s -X github.com/wercker/stern.GitCommit=$WERCKER_GIT_COMMIT -X github.com/wercker/stern.PatchVersion=$(( ($(date +%s) - $(date --date=20150101 +%s) )/(60*60*24) )) -X github.com/wercker/stern.Compiled=$(date +%s)" \
-installsuffix cgo \
-o $WERCKER_OUTPUT_DIR/artifacts/latest/windows_amd64/stern.exe
cp $WERCKER_OUTPUT_DIR/artifacts/latest/windows_amd64/stern.exe $WERCKER_REPORT_ARTIFACTS_DIR
- script:
name: generate SHAs
code: |
cd $WERCKER_OUTPUT_DIR
for f in $(echo "$WERCKER_OUTPUT_DIR/artifacts/latest/linux_amd64/stern" "$WERCKER_OUTPUT_DIR/artifacts/latest/darwin_amd64/stern" "$WERCKER_OUTPUT_DIR/artifacts/latest/windows_amd64/stern.exe"); do
cd $(dirname "$f")
sha256sum $(basename "$f") > SHA256SUMS
done
- script:
name: prepare
code: cp -r scripts $WERCKER_OUTPUT_DIR
release-stable:
steps:
- install-packages:
packages: jshon
- script:
name: version
code: |
export STERN_VERSION=$(./artifacts/latest/linux_amd64/stern --version | awk '{print $3}')
echo "Releasing stern stable v$STERN_VERSION" > $WERCKER_REPORT_MESSAGE_FILE
echo "Releasing stern stable v$STERN_VERSION"
- script:
name: generate release notes
code: |
export RELEASE_NOTES=$(jshon -s "$(./scripts/create-release-notes.sh)" | sed 's/.$//; s/^.//')
echo $RELEASE_NOTES
- github-create-release:
token: $GITHUB_TOKEN
tag: $STERN_VERSION
body: $RELEASE_NOTES
- github-upload-asset:
token: $GITHUB_TOKEN
file: ./artifacts/latest/linux_amd64/stern
filename: stern_linux_amd64
content-type: application/octet-stream
- github-upload-asset:
token: $GITHUB_TOKEN
file: ./artifacts/latest/darwin_amd64/stern
filename: stern_darwin_amd64
content-type: application/octet-stream
- github-upload-asset:
token: $GITHUB_TOKEN
file: ./artifacts/latest/windows_amd64/stern.exe
filename: stern_windows_amd64.exe
content-type: application/octet-stream