File tree Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 11. * /
2+ /output
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ prefix=$( dirname " $0 " ) /../
4+ absPrefix=$( realpath " $prefix " )
5+
6+ docker run \
7+ --rm \
8+ -v " $absPrefix " :/mnt \
9+ -e EX_UID=" $( id -u) " \
10+ -e EX_GID=" $( id -g) " \
11+ golang:1.10 \
12+ /bin/bash -c '
13+ sed -i -e "s;://[^/]*/;://mirrors.aliyun.com/;" /etc/apt/sources.list
14+ apt-get update && apt-get install -yq git zip;
15+ /bin/bash /mnt/build/build.sh;
16+ chown -R $EX_UID:$EX_GID /mnt/output
17+ '
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ cd $( dirname " $0 " )
4+
5+ TMP=' /tmp'
6+ LDFLAGS=' -s -w'
7+ OUTDIR=' ../output'
8+ MAINNAME=' ghfs'
9+ VERSION=" $( git describe --abbrev=0 --tags 2> /dev/null || git rev-parse --abbrev-ref HEAD 2> /dev/null) "
10+ LICENSE=' ../LICENSE'
11+ builds=(' linux 386' ' linux amd64' ' linux arm' ' linux arm64' ' windows 386 .exe' ' windows amd64 .exe' ' darwin 386' ' darwin amd64' )
12+
13+ mkdir -p " $OUTDIR "
14+ rm -rf " $OUTDIR " /*
15+
16+ for build in " ${builds[@]} " ; do
17+ arg=($build )
18+ export GOOS=" ${arg[0]} "
19+ export GOARCH=" ${arg[1]} "
20+ SUFFIX=" ${arg[2]} "
21+
22+ BIN=" $TMP " /" $MAINNAME " " $SUFFIX "
23+ rm -f " $BIN "
24+ go build -ldflags " $LDFLAGS " -o " $BIN " ../src/main.go
25+
26+ OUT=" $OUTDIR " /" $MAINNAME " -" $VERSION " -" $GOOS " -" $GOARCH " .zip
27+ zip -j " $OUT " " $BIN " " $LICENSE "
28+ done
You can’t perform that action at this time.
0 commit comments