forked from oliver006/redis_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·45 lines (31 loc) · 2.54 KB
/
build.sh
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
#!/usr/bin/env bash
export CGO_ENABLED=0
gox --osarch="linux/386" -ldflags "$GO_LDFLAGS" -output "dist/redis_exporter"
echo "Build Docker images"
docker version
echo "docker login"
docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
docker info
echo "docker login done"
docker build --rm=false -t "21zoo/redis_exporter:$CIRCLE_TAG" .
docker build --rm=false -t "21zoo/redis_exporter:latest" .
docker push "21zoo/redis_exporter:latest"
docker push "21zoo/redis_exporter:$CIRCLE_TAG"
docker build --rm=false -t "oliver006/redis_exporter:$CIRCLE_TAG" .
docker build --rm=false -t "oliver006/redis_exporter:latest" .
docker push "oliver006/redis_exporter:latest"
docker push "oliver006/redis_exporter:$CIRCLE_TAG"
echo "Building binaries"
echo ""
echo $GO_LDFLAGS
gox -rebuild --osarch="darwin/amd64" -ldflags "$GO_LDFLAGS" -output "dist/redis_exporter" && cd dist && tar -cvzf redis_exporter-$CIRCLE_TAG.darwin-amd64.tar.gz redis_exporter && rm redis_exporter && cd ..
gox -rebuild --osarch="darwin/386" -ldflags "$GO_LDFLAGS" -output "dist/redis_exporter" && cd dist && tar -cvzf redis_exporter-$CIRCLE_TAG.darwin-386.tar.gz redis_exporter && rm redis_exporter && cd ..
gox -rebuild --osarch="linux/amd64" -ldflags "$GO_LDFLAGS" -output "dist/redis_exporter" && cd dist && tar -cvzf redis_exporter-$CIRCLE_TAG.linux-amd64.tar.gz redis_exporter && rm redis_exporter && cd ..
gox -rebuild --osarch="linux/386" -ldflags "$GO_LDFLAGS" -output "dist/redis_exporter" && cd dist && tar -cvzf redis_exporter-$CIRCLE_TAG.linux-386.tar.gz redis_exporter && rm redis_exporter && cd ..
gox -rebuild --osarch="netbsd/amd64" -ldflags "$GO_LDFLAGS" -output "dist/redis_exporter" && cd dist && tar -cvzf redis_exporter-$CIRCLE_TAG.netbsd-amd64.tar.gz redis_exporter && rm redis_exporter && cd ..
gox -rebuild --osarch="netbsd/386" -ldflags "$GO_LDFLAGS" -output "dist/redis_exporter" && cd dist && tar -cvzf redis_exporter-$CIRCLE_TAG.netbsd-386.tar.gz redis_exporter && rm redis_exporter && cd ..
gox -rebuild --osarch="windows/amd64" -ldflags "$GO_LDFLAGS" -output "dist/redis_exporter" && cd dist && zip -9 redis_exporter-$CIRCLE_TAG.windows-amd64.zip redis_exporter.exe && rm redis_exporter.exe && cd ..
gox -rebuild --osarch="windows/386" -ldflags "$GO_LDFLAGS" -output "dist/redis_exporter" && cd dist && zip -9 redis_exporter-$CIRCLE_TAG.windows-386.zip redis_exporter.exe && rm redis_exporter.exe && cd ..
echo "Upload to Github"
ghr -t $GITHUB_TOKEN -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME --replace $CIRCLE_TAG dist/
echo "Done"