|
|
@ -26,6 +26,7 @@ buildAssets () {
|
|
|
|
yarn run build
|
|
|
|
yarn run build
|
|
|
|
|
|
|
|
|
|
|
|
if ! [ -x "$(command -v statik)" ]; then
|
|
|
|
if ! [ -x "$(command -v statik)" ]; then
|
|
|
|
|
|
|
|
export CGO_ENABLED=0
|
|
|
|
go get github.com/rakyll/statik
|
|
|
|
go get github.com/rakyll/statik
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
@ -43,21 +44,34 @@ _build() {
|
|
|
|
IFS=/ read -r -a arr <<<"$osarch"
|
|
|
|
IFS=/ read -r -a arr <<<"$osarch"
|
|
|
|
os="${arr[0]}"
|
|
|
|
os="${arr[0]}"
|
|
|
|
arch="${arr[1]}"
|
|
|
|
arch="${arr[1]}"
|
|
|
|
|
|
|
|
gcc="${arr[2]}"
|
|
|
|
|
|
|
|
|
|
|
|
# Go build to build the binary.
|
|
|
|
# Go build to build the binary.
|
|
|
|
export GOOS=$os
|
|
|
|
export GOOS=$os
|
|
|
|
export GOARCH=$arch
|
|
|
|
export GOARCH=$arch
|
|
|
|
|
|
|
|
export CC=$gcc
|
|
|
|
go build -a -o cloudreve_$VERSION_$GOOS_$GOARCH -ldflags " -X 'github.com/HFO4/cloudreve/pkg/conf.BackendVersion=$VERSION' -X 'github.com/HFO4/cloudreve/pkg/conf.LastCommit=$COMMIT_SHA'"
|
|
|
|
export CGO_ENABLED=1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
out="release/cloudreve_${VERSION}_${os}_${arch}"
|
|
|
|
|
|
|
|
go build -a -o "${out}" -ldflags " -X 'github.com/HFO4/cloudreve/pkg/conf.BackendVersion=$VERSION' -X 'github.com/HFO4/cloudreve/pkg/conf.LastCommit=$COMMIT_SHA'"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$os" = "windows" ]; then
|
|
|
|
|
|
|
|
mv $out release/cloudreve.exe
|
|
|
|
|
|
|
|
zip -j -q "${out}.zip" release/cloudreve.exe
|
|
|
|
|
|
|
|
rm -f "release/cloudreve.exe"
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
mv $out release/cloudreve
|
|
|
|
|
|
|
|
tar -zcvf "${out}.tar.gz" -C release cloudreve
|
|
|
|
|
|
|
|
rm -f "release/cloudreve"
|
|
|
|
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
release(){
|
|
|
|
release(){
|
|
|
|
cd $REPO
|
|
|
|
cd $REPO
|
|
|
|
export CGO_ENABLED=1
|
|
|
|
|
|
|
|
## List of architectures and OS to test coss compilation.
|
|
|
|
## List of architectures and OS to test coss compilation.
|
|
|
|
SUPPORTED_OSARCH="linux/arm64 darwin/amd64 windows/amd64 linux/arm linux/386 windows/386"
|
|
|
|
SUPPORTED_OSARCH="linux/amd64/gcc linux/arm/arm-linux-gnueabihf-gcc windows/amd64/x86_64-w64-mingw32-gcc"
|
|
|
|
|
|
|
|
|
|
|
|
echo "Release builds for OS/Arch: ${SUPPORTED_OSARCH}"
|
|
|
|
echo "Release builds for OS/Arch/CC: ${SUPPORTED_OSARCH}"
|
|
|
|
for each_osarch in ${SUPPORTED_OSARCH}; do
|
|
|
|
for each_osarch in ${SUPPORTED_OSARCH}; do
|
|
|
|
_build "${each_osarch}"
|
|
|
|
_build "${each_osarch}"
|
|
|
|
done
|
|
|
|
done
|
|
|
@ -81,7 +95,7 @@ while getopts "bacr:d" o; do
|
|
|
|
BINARY="true"
|
|
|
|
BINARY="true"
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
r)
|
|
|
|
r)
|
|
|
|
ASSETS="true"
|
|
|
|
# ASSETS="true"
|
|
|
|
RELEASE="true"
|
|
|
|
RELEASE="true"
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
d)
|
|
|
|
d)
|
|
|
@ -108,4 +122,4 @@ fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$RELEASE" = "true" ]; then
|
|
|
|
if [ "$RELEASE" = "true" ]; then
|
|
|
|
release
|
|
|
|
release
|
|
|
|
fi
|
|
|
|
fi
|