File tree Expand file tree Collapse file tree 4 files changed +50
-23
lines changed Expand file tree Collapse file tree 4 files changed +50
-23
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ prefix=$( dirname " $0 " ) /../
4+ absPrefix=$( realpath " $prefix " )
5+
6+ rm -rf " $prefix /output/"
7+
8+ buildByDocker () {
9+ gover=" $1 "
10+ shift
11+ docker pull golang:" $gover "
12+
13+ docker run \
14+ --rm \
15+ -v " $absPrefix " :/mnt \
16+ -e EX_UID=" $( id -u) " \
17+ -e EX_GID=" $( id -g) " \
18+ golang:" $gover " \
19+ /bin/bash -c '
20+ sed -i -e "s;://[^/]*/;://mirrors.aliyun.com/;" /etc/apt/sources.list;
21+ apt-get update && apt-get install -yq git zip;
22+ /bin/bash /mnt/build/build.sh "$@";
23+ chown -R $EX_UID:$EX_GID /mnt/output
24+ ' \
25+ ' container-script' \
26+ " $@ "
27+ }
28+
29+ gover=latest
30+ builds=(' linux 386' ' linux amd64' ' linux arm' ' linux arm64' ' windows 386' ' windows amd64' ' darwin 386' ' darwin amd64' )
31+ buildByDocker " $gover " " ${builds[@]} "
32+
33+ gover=1.10
34+ builds=(' windows 386 -xp-vista' ' windows amd64 -xp-vista' )
35+ buildByDocker " $gover " " ${builds[@]} "
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ cd $( dirname " $0 " )
4+ rm -rf ../output/
5+
6+ builds=(' linux 386' ' linux amd64' ' linux arm' ' linux arm64' ' windows 386 .exe' ' windows amd64 .exe' ' darwin 386' ' darwin amd64' )
7+ bash ./build.sh " ${builds[@]} "
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -8,21 +8,23 @@ OUTDIR='../output'
88MAINNAME=' ghfs'
99VERSION=" $( git describe --abbrev=0 --tags 2> /dev/null || git rev-parse --abbrev-ref HEAD 2> /dev/null) "
1010LICENSE=' ../LICENSE'
11- builds=(' linux 386' ' linux amd64' ' linux arm' ' linux arm64' ' windows 386 .exe' ' windows amd64 .exe' ' darwin 386' ' darwin amd64' )
1211
1312mkdir -p " $OUTDIR "
14- rm -rf " $OUTDIR " /*
1513
16- for build in " ${builds[@]} " ; do
14+ for build in " $@ " ; do
1715 arg=($build )
1816 export GOOS=" ${arg[0]} "
1917 export GOARCH=" ${arg[1]} "
20- SUFFIX =" ${arg[2]} "
18+ OS_SUFFIX =" ${arg[2]} "
2119
22- BIN=" $TMP " /" $MAINNAME " " $SUFFIX "
20+ BIN=" $TMP " /" $MAINNAME "
21+ if [ " $GOOS " == ' windows' ]; then
22+ BIN=" ${BIN} .exe"
23+ fi ;
2324 rm -f " $BIN "
25+ echo " Building: $GOOS $GOARCH "
2426 go build -ldflags " $LDFLAGS " -o " $BIN " ../src/main.go
2527
26- OUT=" $OUTDIR " /" $MAINNAME " -" $VERSION " -" $GOOS " -" $GOARCH " .zip
28+ OUT=" $OUTDIR " /" $MAINNAME " -" $VERSION " -" $GOOS " " $OS_SUFFIX " -" $GOARCH " .zip
2729 zip -j " $OUT " " $BIN " " $LICENSE "
2830done
You can’t perform that action at this time.
0 commit comments