-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgo_builder.sh
executable file
·40 lines (31 loc) · 973 Bytes
/
go_builder.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
#!/bin/bash
set -e
mkdir -p $OUTPUT_BINARIES
mkdir -p $GOPACKAGES
echo ' '
echo '------------------'
echo "Adding user $DO_USER"
echo '------------------'
echo ' '
useradd $DO_USER -u $DO_UID
echo '------------------'
echo "Reading $GOREPOS and fetching with git"
echo '------------------'
echo ' '
# REMOVE OLD PACKAGES
set -x
cd $GOPACKAGES
rm -rf $GOPACKAGES/*
# Clone GIT REPOS TO GET PAKCAGES
cat $INPUT_REPOS | while read package
do
cd $GOPACKAGES
go get $package && \
cd $OUTPUT_BINARIES && \
GOOS=windows GOARCH=amd64 go build -o ${package}-windows.exe ${package} && mv ${package}-windows.exe ./$(basename ${package})-windows.exe
GOOS=linux GOARCH=amd64 go build -o ${package}-linux ${package} && mv ${package}-linux ./$(basename ${package})-linux
GOOS=darwin GOARCH=amd64 go build -o ${package}-darwin ${package} && mv ${package}-darwin ./$(basename ${package})-darwin
done
set +x
chown -R $DO_USER:$DO_USER /gowork
ls -alsht $OUTPUT_BINARIES