-
Notifications
You must be signed in to change notification settings - Fork 39
/
BUILD.yaml
153 lines (153 loc) · 4.4 KB
/
BUILD.yaml
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
packages:
- name: server
type: go
deps:
- pkg/store/postgres:rice
- pkg/webui:rice
argdeps:
- version
- date
srcs:
- "server.go"
- "cmd/**/*.go"
- "pkg/**/*.go"
- "go.mod"
- "go.sum"
env:
- CGO_ENABLED=0
config:
generate: true
dontTest: true
buildFlags:
- -tags
- server
- -ldflags
- -X 'github.com/csweichel/werft/pkg/version.Version=${version}' -X 'github.com/csweichel/werft/pkg/version.Commit=${__git_commit}' -X 'github.com/csweichel/werft/pkg/version.Date=${date}'
- name: plugin-client-lib
type: go
config:
packaging: library
srcs:
- "pkg/plugin/client/*.go"
- "pkg/plugin/common/*.go"
- "pkg/filterexpr/*.go"
- "pkg/reporef/*.go"
- "pkg/api/**/*.go"
- "go.mod"
- "go.sum"
- name: server-release
type: docker
deps:
- :server
- plugins:all
argdeps:
- version
config:
dockerfile: "server.Dockerfile"
image:
- csweichel/werft:${version}
- name: client-linux-amd64
type: go
srcs:
- "cmd/client/**/*.go"
- "pkg/**/*.go"
- "client.go"
- "go.mod"
- "go.sum"
env:
- CGO_ENABLED=0
- GOOS=linux
- GOARCH=amd64
argdeps:
- version
- date
config:
dontTest: true
buildFlags:
- -tags
- client
- -ldflags
- -X 'github.com/csweichel/werft/pkg/version.Version=${version}' -X 'github.com/csweichel/werft/pkg/version.Commit=${__git_commit}' -X 'github.com/csweichel/werft/pkg/version.Date=${date}'
- name: client-darwin-amd64
type: go
srcs:
- "cmd/client/**/*.go"
- "pkg/**/*.go"
- "client.go"
- "go.mod"
- "go.sum"
argdeps:
- version
- date
env:
- CGO_ENABLED=0
- GOOS=darwin
- GOARCH=amd64
config:
dontTest: true
buildFlags:
- -tags
- client
- -ldflags
- -X 'github.com/csweichel/werft/pkg/version.Version=${version}' -X 'github.com/csweichel/werft/pkg/version.Commit=${__git_commit}' -X 'github.com/csweichel/werft/pkg/version.Date=${date}'
- name: changelog
type: generic
srcs:
- ".git/**/*"
config:
commands:
# - ["git", "describe", "--exact-match", "HEAD"]
- - sh
- -c
- |
latest=$(git describe --tags `git rev-list --tags --max-count=1`)
comparison="$latest..HEAD"
if [ -z "$latest" ]; then comparison=""; fi
git log $comparison --oneline --no-merges > changelog.txt
git rev-parse --abbrev-ref HEAD > version.txt
curl https://api.github.com/repos/csweichel/werft/compare/refs/tags/$latest...master | jq -r .commits[].author.login | sort | uniq > contributor.txt
echo "Version: $(cat version.txt)"
echo Changelog:
cat changelog.txt
echo Contributor:
cat contributor.txt
- name: release
type: generic
deps:
- :client-darwin-amd64
- :client-linux-amd64
- :server-release
- :changelog
argdeps:
- version
config:
commands:
- - sh
- -c
- |
echo "## Server Docker images" >> desc.txt
echo "<pre>$(cat server-release/imgnames.txt)</pre>" >> desc.txt
echo >> desc.txt
echo "## Changelog" >> desc.txt
cat changelog/changelog.txt >> desc.txt
echo >> desc.txt
echo "## Contributor" >> desc.txt
for i in $(cat changelog/contributor.txt); do
echo "- [$i](https://github.com/$i)" >> desc.txt
done
- ["mkdir", "dist"]
- ["mv", "client-darwin-amd64/werft", "dist/werft-client-darwin-amd64"]
- ["mv", "client-linux-amd64/werft", "dist/werft-client-linux-amd64"]
- ["sh", "-c", "cd dist; for i in $(ls); do echo tar cvvfz $i.tar.gz $i; done | sh"]
- ["sh", "-c", "curl -L https://github.com/c4milo/github-release/releases/download/v1.1.0/github-release_v1.1.0_linux_amd64.tar.gz | tar xz"]
- ["sh", "-c", "./github-release csweichel/werft ${version} main \"$(cat desc.txt)\" 'dist/*.tar.gz'"]
- name: all
type: generic
deps:
- plugins:all
- :client-darwin-amd64
- :client-linux-amd64
- :server
config:
commands:
- ["touch", "x"]